Skip to content

Commit e66a980

Browse files
committed
Part 1 finished.
1 parent f2ac6e2 commit e66a980

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

curl-commands.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
curl --header "Content-Type: application/json" -X POST http://127.0.0.1:8000/api/token/obtain/ --data '{"username":"djsr","password":"djsr"}'
22
curl --header "Content-Type: application/json" -X POST http://127.0.0.1:8000/api/user/create/ --data '{"email":"ichiro@mariners.com","username":"ichiro1","password":"konnichiwa"}'
3-
curl --header "Content-Type: application/json" --header "Authorization: JWT eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImV4cCI6MTU2MTYyMTg0OSwianRpIjoiYmE3OWUxZTEwOWJkNGU3NmI1YWZhNWQ5OTg5MTE0NjgiLCJ1c2VyX2lkIjoxfQ.S7tDJaaymUUNs74Gnt6dX2prIU_E8uqCPzMtd8Le0VI","access":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNTYwMjIxODU1LCJqdGkiOiI0ZjFiZDE3OTE0Zjk0MjRhOTNlZDA1YTBhMTM0N2U3YSIsInVzZXJfaWQiOjg3LCJ1c2VybmFtZSI6ImJsdWU4In0.69YNgpXhkzOklIS_nXolVuYwvN4vh7jlSeQ-oQxqxjg" -X POST http://127.0.0.1:8000/api/token/refresh/ --data '{"refresh":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImV4cCI6MTU2MTYyMTg0OSwianRpIjoiYmE3OWUxZTEwOWJkNGU3NmI1YWZhNWQ5OTg5MTE0NjgiLCJ1c2VyX2lkIjoxfQ.S7tDJaaymUUNs74Gnt6dX2prIU_E8uqCPzMtd8Le0VI"}'
43
curl --header "Content-Type: application/json" -X POST http://127.0.0.1:8000/api/token/refresh/ --data '{"refresh":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImV4cCI6MTU2MTYyMTg0OSwianRpIjoiYmE3OWUxZTEwOWJkNGU3NmI1YWZhNWQ5OTg5MTE0NjgiLCJ1c2VyX2lkIjoxfQ.S7tDJaaymUUNs74Gnt6dX2prIU_E8uqCPzMtd8Le0VI"}'
4+
curl --header "Content-Type: application/json" --header "Authorization: JWT eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNTYwNDI5MTE2LCJqdGkiOiI1NWVlZDA4MGQ2YTg0MzI4YTZkZTE0Mjg4ZjE3OWE0YyIsInVzZXJfaWQiOjIsImZhdl9jb2xvciI6IiJ9.LXqfhFifGDA6Qg8s4Knl1grPusTLX1lh4YKWuQUuv-k" -X GET http://127.0.0.1:8000/api/hello/

djsr/authentication/urls.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
from django.urls import path
22
from rest_framework_simplejwt import views as jwt_views
3-
from .views import ObtainTokenPairWithColorView, CustomUserCreate
3+
from .views import ObtainTokenPairWithColorView, CustomUserCreate, HelloWorldView
44

55
urlpatterns = [
66
path('user/create/', CustomUserCreate.as_view(), name="create_user"),
77
path('token/obtain/', ObtainTokenPairWithColorView.as_view(), name='token_create'),
88
path('token/refresh/', jwt_views.TokenRefreshView.as_view(), name='token_refresh'),
9+
path('hello/', HelloWorldView.as_view(), name='hello_world')
910
]

djsr/authentication/views.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,9 @@ def post(self, request, format='json'):
2121
json = serializer.data
2222
return Response(json, status=status.HTTP_201_CREATED)
2323
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
24+
25+
26+
class HelloWorldView(APIView):
27+
28+
def get(self, request):
29+
return Response(data={"hello":"world"}, status=status.HTTP_200_OK)

0 commit comments

Comments
 (0)