JumboCode / ProjectShare

JumboCode 2020-2021 project for Project SHARE, led by Meguna Okawa.
MIT License
3 stars 0 forks source link

Add A Test Endpoint #54

Closed meguna closed 3 years ago

meguna commented 4 years ago

This is a pared back version of the task I assigned earlier - and it's still an important and useful task! Set up a dummy endpoint using Django. The endpoint should return a json string {testResponse: 'success'}. Use JsonResponse in views.py file to do this. Then, set up an endpoint /test in urls.py. Finally, download the Postman application and test that your endpoint works.

The dummy endpoint will be useful for us to double check that our server is actually working. When our real endpoints have bugs or aren't doing what they should be doing, we can use the dummy endpoint to narrow down where the problem could be.

Views: https://docs.djangoproject.com/en/dev/ref/request-response/#jsonresponse-objects https://stackoverflow.com/questions/35019030/how-to-return-custom-json-in-django-rest-framework

Routes: https://www.caktusgroup.com/blog/2019/02/01/creating-api-endpoint-django-rest-framework/

Postman: https://www.postman.com/downloads/ https://buttercms.com/blog/postman-testing-the-api-development-environment

meguna commented 4 years ago

Hey Julia, quick update that I'd like you to do on this branch

  1. Make a new urls.py file in /api.
  2. Set up a router there and put your test endpoint in that router: https://www.django-rest-framework.org/api-guide/routers/#simplerouter
  3. Import this router in the drf_project/urls.py, at the path /api

We do this in order to namespace our urls.