5/15

justyoon·2023년 5월 16일
0

본 내용은 ChatGPT를 사용하여 작성된 글입니다

role of Request and Response messages and the difference

Request and Response messages are the backbone of web communication. A Request message is sent by a client to a server, asking for specific information or actions. The server then processes the request and sends a Response message back to the client, which contains the requested information or actions. The main difference between the two is that the Request message initiates the communication and the Response message responds to the request.

For more information, you can refer to this link:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Messages
https://velog.io/@bky373/Web-HTTP와-HTTPS-초간단-정리

2. flow of requests on the web and request, receive data

To understand the flow of requests on the web, you need to know how a client sends a request to a server and how the server responds. When a client wants to request data from a server, it sends an HTTP request message to the server. The server processes the request and sends an HTTP response message back to the client. The client then receives the response and displays the data.

For more information, you can refer to this link:

https://developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web/How_the_Web_works
https://developer.mozilla.org/en-US/docs/Web/HTTP/Overview

3. Setup DRF project

Django Rest Framework (DRF) is a powerful and flexible toolkit for building Web APIs. To set up a project with DRF, you need to have Django installed. Once you have Django installed, you can install DRF using pip. After installation, you can create a new Django project and configure it to use DRF.

For more information, you can refer to this link: https://www.django-rest-framework.org/tutorial/quickstart/

4. meaning and role of serializers and implement CRUD

In DRF, serializers are used to convert complex data types, such as Django model instances, into JSON, XML, or other content types that can be easily processed by client-side applications. Serializers also provide deserialization, allowing parsed data to be converted back into complex types, after first validating the incoming data. To implement CRUD, you need to create views that use DRF serializers to read, create, update, and delete data.

For more information, you can refer to this link:
https://www.django-rest-framework.org/tutorial/1-serialization/
https://www.django-rest-framework.org/api-guide/serializers/

5. DRF development using Postman or Swagger

Postman and Swagger are tools used to test and debug Web APIs. They allow you to send HTTP requests to your API and inspect the responses. You can use Postman or Swagger to test DRF APIs by sending requests to the API endpoints and verifying that the responses match the expected results.

For more information, you can refer to these links:
https://www.postman.com/
https://swagger.io/
https://www.django-rest-framework.org/topics/api-documentation/

6. Create a class view

Class-based views are a powerful feature of Django that allow you to reuse code and define complex views with less code. In DRF, you can use class-based views to define API views that handle HTTP requests and responses.

For more information, you can refer to this link: https://www.django-rest-framework.org/api-guide/views/

Cookie session login and token login are two different authentication methods used in web development. Cookie session login stores a session ID in a cookie on the client side, and the server uses this session ID to authenticate the client on subsequent requests. Token login uses a token, typically a JSON Web Token (JWT), to authenticate the client. The token is sent with each request in the HTTP Authorization header, and the server uses this token to authenticate the client.

For more information, you can refer to this link:
https://www.django-rest-framework.org/api-guide/authentication/
https://auth0.com/blog/cookies-vs-tokens-definitive-guide/

8. Implement membership registration and login using JWT in Django

JWT (JSON Web Tokens) can be used for authentication and authorization in Django projects. You can implement membership registration and login using JWT by integrating a JWT library, such as django-rest-framework-simplejwt, into your Django project. This library provides JWT authentication views and serializers to handle registration, login, and token generation.

For more information, you can refer to this link:
https://django-rest-framework-simplejwt.readthedocs.io/
https://simpleisbetterthancomplex.com/tutorial/2018/12/19/how-to-use-jwt-authentication-with-django-rest-framework.html

9. set expiration period for token, and get refresh token

You can find more information and advanced usage options in the official documentation of django-rest-framework-simplejwt:

Library Documentation: https://django-rest-framework-simplejwt.readthedocs.io/
GitHub Repository: https://github.com/jazzband/django-rest-framework-simplejwt

In Django, a many-to-many relationship is a relationship where an object of one type can be related to multiple objects of another type, and vice versa. You can establish a many-to-many relationship in Django models using the ManyToManyField field type. The related_name attribute is used to specify the reverse name for the relationship from the related model back to the model that defines the relationship.

For more information, you can refer to this link:

https://docs.djangoproject.com/en/4.2/topics/db/examples/many_to_many/

https://www.django-rest-framework.org/api-guide/relations/#many-to-many-relationships.

11. media files and static files

In web development, media files and static files are two types of files used to serve different types of content. Media files are user-uploaded files, such as images or documents, that are served dynamically. Static files, on the other hand, are files that are not expected to change frequently and are served directly from the server without any dynamic processing.

For more information, you can refer to these links:

https://docs.djangoproject.com/en/4.2/howto/static-files/
https://docs.djangoproject.com/en/4.2/howto/static-files/#serving-files-uploaded-by-a-user-during-development

Please note that the references provided are general resources related to the topics mentioned, and you may need to explore them further based on your specific requirements and the technologies you are using.

profile
with gratitude, optimism is sustainable

0개의 댓글