Skip to content

Cellou404/AwesomeBlogAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Here'se an Awesome Blog API

Summary

This is a simple blog api that allows users to create , read, update and delete posts. It uses Django & DjangoRestFramework as the server framework with Postgres for database management.

Screenshots

Screenshot

How to use ?

Clone the repo

git clone https://github.com/Cellou404/AwesomeBlogAPI.git

Create a virtual environment

python3 -m venv venv

Activate the virtual environment

source venv/bin/activate

Install the dependencies

pip install -r requirements.txt

Create a .env file

touch .env

Fill the .env file with the following values:

SECRET_KEY=your_secret_key
DEBUG=True
DB_NAME=your_db_name
DB_USER=your_db_user
DB_PASSWORD=your_db_password
DB_HOST=your_db_host
DB_PORT=your_db_port

Migrate the database

python manage.py makemigrations # you can specify the app name. e.g. python manage.py makemigrations blog
python manage.py migrate

Create a superuser

python manage.py createsuperuser

Run the server

python manage.py runserver

Access the server

For example: Posts

http://127.0.0.1:8000/api/v1/blog/posts/

Endpoints

For example: Posts Endpoints

Method Endpoint Description
GET /api/v1/blog/posts/ Get all posts
GET /api/v1/blog/posts/{id}/ Get a post by id
POST /api/v1/blog/posts/ Create a post
PUT /api/v1/blog/posts/{id}/ Update a post by id
DELETE /api/v1/blog/posts/{id}/ Delete a post by id

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages