Skip to content

Commit

Permalink
feat: 프로젝트 api 생성 (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
pasitoapasito committed Jul 18, 2022
1 parent 048fb9e commit c63c985
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 1 deletion.
Empty file added api/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions api/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
6 changes: 6 additions & 0 deletions api/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class ApiConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'api'
Empty file added api/migrations/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions api/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.db import models

# Create your models here.
3 changes: 3 additions & 0 deletions api/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.test import TestCase

# Create your tests here.
7 changes: 7 additions & 0 deletions api/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from django.urls import path

from api.views import HelloApiView

urlpatterns = [
path('/hello', HelloApiView.as_view()),
]
13 changes: 13 additions & 0 deletions api/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from rest_framework.views import APIView
from rest_framework.permissions import AllowAny
from rest_framework.response import Response

from drf_yasg.utils import swagger_auto_schema

class HelloApiView(APIView):
permission_classes = [AllowAny]

@swagger_auto_schema(responses={200: 'Hello'})
def get(self, request):
message = 'Hello'
return Response({'message': message}, status=200)
2 changes: 1 addition & 1 deletion ideaconcert/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
)

urlpatterns = [

path('api', include('api.urls')),
]

urlpatterns += [
Expand Down

0 comments on commit c63c985

Please sign in to comment.