Blog API built using Django & Django Rest Framework, deployed through Heroku.
- Custom User
- Auth using JWT
- CRUD blogs
Also check out the source code and website of the React Application built on this API
To test the following endpoints use Postman or CURL
Pass form data as key-value pairs in body. Auth credentials to be passed in header as: Authorization: JWT <access_token>
/api/user/create/
POST - Creates new user (email, username, password as form data)/api/token/
POST - Login, returns access and refresh tokens (email & password form data)/api/token/refresh/
POST - Get new access token (refresh token as form data)/api/user/logout/blacklist/
POST - Blacklists token (refresh_token as form data)/api/blog/
GET - Retrive all blogs
POST - Create new blog (title and body as form data)/api/blog/<slug>/
GET - Retrive specific blog
PUT - Update specific blog (title and body as form data)
DELETE - Delete specific blog
Clone the repo:
git clone https://github.com/namanshah01/django-blog-api.git
Now cd into cloned repo, create a virtualenv and pip install the requirements
cd ecom-django
virtualenv venv
pip3 install -r requirements.txt
source venv/bin/activate
Create and apply the migrations
python3 manage.py makemigrations
python3 manage.py migrate
Create a superuser for admin privilages
python3 manage.py createsuperuser
Now set the variables DJANGO_SECRET_KEY
and DEBUG_VALUE
from core/settings.py
either as environment variables or hard code them into the file itself.
Start the server
python3 manage.py runserver
Head over to localhost:8000, or Postman to use the application