Pand-Aid / pandaid-api

backend for Pand-Aid pandemic response app
3 stars 3 forks source link

Add CORS Support #13

Open bhgrant8 opened 4 years ago

bhgrant8 commented 4 years ago

Summary

Our API will need to be accessible to a frontend javascript application, as such it will need to enable CORS support to allow requests to be made directly from client/browser

https://www.django-rest-framework.org/topics/ajax-csrf-cors/

Basic behavior example

The django-cors-headers package's readme discusses this in more depth:

https://github.com/adamchainz/django-cors-headers/blob/master/README.rst

Solution should provide implementation of package, along with testing which confirms the proper headers are being set on api calls

Motivation

This will support end users using the website, and is a hard requirement