Floran Book Display is an open Api created for React.js workshop for beginner to fetch latest and other book data along with posting new book data.
Each book object will look like this
{ "id": 3, "name": "Dummy Book 2", "author": "Elon Musk", "description": "Lorem Ipsum is simply dummy text of the printing and ….", "price": 500.0, "pages": 200, "cover": "https://res.cloudinary.com/floran-music/raw/upload/v1/media/default.jpg" }
- To get the latest book data
API: https://floran-book-api.herokuapp.com/latest/
This will return you list of 5 latest books only
- To get other book data
API: https://floran-book-api.herokuapp.com/
This will return you remaining book data other than the latest books
- To get specific book data for detail page
API: https://floran-book-api.herokuapp.com/
This will return you specific book data
- To post new book data API: https://floran-book-api.herokuapp.com/ [USE POST REQUEST]
The formdata should contain exactly the same following key
- field: name type: String
- field: author type: String
- field: description: type: String
- field: price: type: Float
- field: pages: type: Integer
- field: cover: type: Image File
Python v.3.8+
for windows, create virtual env using virtualenvwrapper-win
pip install virtualenvwrapper-win
mkvirtualenv reactdj
for linux & mac use this command
apt-get install python3-venv
python3 -m venv reactdj
To activate environment in windows
workon reactdj
To activate environment in linux & mac
source reactdj/bin/activate
Copy Paste the following commands to clone the repo
https://github.com/Floran-Github/Floran_POS.git
Go inside the floran_pos_backend directory and install the module from requirements.txt
cd floran_pos_backend
pip install -r requirements.txt
Then make the migrations and then migrate the database
python manage.py makemigrations
python manage.py migrate
Create the superuser
python manage.py createsuperuser
Now run the django server on your local network instead of localhost for react to communicate
python manage.py runserver 0.0.0.0:8000
http://127.0.0.1:8000/api/auth