ADD: Api endpoint for search suggestions
This commit is contained in:
0
api/__init__.py
Normal file
0
api/__init__.py
Normal file
6
api/urls.py
Normal file
6
api/urls.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from django.urls import path
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
path('', views.query)
|
||||
]
|
||||
10
api/views.py
Normal file
10
api/views.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.decorators import api_view
|
||||
from core.models import Video
|
||||
from core.serializers import VideoSerializer
|
||||
|
||||
@api_view(['GET'])
|
||||
def query(request):
|
||||
videos = Video.objects.all()
|
||||
serializer = VideoSerializer(videos, many=True)
|
||||
return Response(serializer.data)
|
||||
Reference in New Issue
Block a user