From 0c9b27d20257a9d74a20dcf845a781f3b7c0a30c Mon Sep 17 00:00:00 2001 From: Sverre Nystad Date: Thu, 4 Jan 2024 22:11:51 +0100 Subject: [PATCH] Feat: Remove hello_world view from api/urls.py and view --- backend/api/urls.py | 2 -- backend/api/views.py | 25 ------------------------- 2 files changed, 27 deletions(-) diff --git a/backend/api/urls.py b/backend/api/urls.py index eb965703..f9157b88 100644 --- a/backend/api/urls.py +++ b/backend/api/urls.py @@ -1,10 +1,8 @@ from django.urls import path -from api.views import hello_world from users.views import LoginView, RegisterUser urlpatterns = [ - path("hello_word", hello_world), path("create-user/", RegisterUser, name="create-user"), path("login/", LoginView, name="login"), ] diff --git a/backend/api/views.py b/backend/api/views.py index 55c4a2f9..e79ddc06 100644 --- a/backend/api/views.py +++ b/backend/api/views.py @@ -5,28 +5,3 @@ # Define your expected request body as a serializer from rest_framework import serializers - - -class HelloWorldSerializer(serializers.Serializer): - name = serializers.CharField( - required=True, help_text="Name of the person to greet." - ) - - -@swagger_auto_schema( - method="post", - request_body=HelloWorldSerializer, - operation_description="Post a name and receive a 'Hello' greeting in return.", -) -@api_view(["POST"]) -def hello_world(request): - """ - POST: - Receive a name in the request body and return a greeting. - """ - serializer = HelloWorldSerializer(data=request.data) - if serializer.is_valid(): - name = serializer.validated_data.get("name") - return Response(f"Hello {name}") - else: - return Response(serializer.errors, status=400)