Skip to content

Online Store API using Django, DRF (Django Rest Framework) and JWT .The API was used with a React front-end project. but could be used with any UI lib.

License

Notifications You must be signed in to change notification settings

Ahmed-Abdelgawad-Dev/Online_Store

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sprints' Online Store Backend API (Django):

Introduction

This is a REST API for an E-commerce website that interacts with any Frontend.


Setup

Database config

The API backend connects with sqlite database, but any other database can be used instead in case of production.

Database Schema

Schema.png is located in the root folder.

Start

Clone the repo: git clone https://github.com/Ahmed-Abdelgawad-Dev/Sprints_Online_Store.git Use a virtual environment that you prefere.Could be pipenv | venv | conda. Install the required packages:

pip install -r requirements.txt

Apply migrations:

python manage.py migrate

Create an admin user:

python manage.py createsuperuser

Run the server:

python manage.py runserver

Environment variables

.env is required and must be inside .git ignore for security. Here python dotenv package is used, feel free to use any other solution, also put any other credentials here like api secrets key ...etc. Example for the required .env :.

SECRET_KEY=django-insecure-9kr=#(!7bp2n65^e4i!5vm6e_3ux3qd7nb0jc2j@i7jyhw)6qa
DATABASE=....etc

Endpoints

        'users/'
        POST: 'login/' 
        GET:  'get_user/'
        GET:  'get_users/'
        PUT:  'update_user/'
        POST: 'register_user/'

        'products/' 
        GET:  ''                          |     get all products
        GET:  '/{id}'                     |     get a product

        'orders/'
        GET: ''                           | get orders of user  
        POST:  'add_order/'               | add items to order or make an order and put items inside
        GET:  'my_orders/'                | get orders of a user
        POST: '{order_id}/Delivered/'     | change the order status to delivered after delivery
        GET:  '{order_id}/'               | get order by order id
        POST: '{order_id}/paid/'          | change the payment status to paid

About

Online Store API using Django, DRF (Django Rest Framework) and JWT .The API was used with a React front-end project. but could be used with any UI lib.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published