Skip to content

Blog API using Django Rest Framework to be used as a backend for React application

Notifications You must be signed in to change notification settings

namanshah01/django-blog-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django Blog API

Blog API built using Django & Django Rest Framework, deployed through Heroku.

Features

  • Custom User
  • Auth using JWT
  • CRUD blogs

Also check out the source code and website of the React Application built on this API

API Endpoints

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

Setup

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


Developed with ❤️ by Naman Shah

About

Blog API using Django Rest Framework to be used as a backend for React application

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published