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 reactdjfor linux & mac use this command
apt-get install python3-venv
python3 -m venv reactdjTo activate environment in windows
workon reactdjTo activate environment in linux & mac
source reactdj/bin/activateCopy Paste the following commands to clone the repo
https://github.com/Floran-Github/Floran_POS.gitGo inside the floran_pos_backend directory and install the module from requirements.txt
cd floran_pos_backend
pip install -r requirements.txtThen make the migrations and then migrate the database
python manage.py makemigrations
python manage.py migrateCreate the superuser
python manage.py createsuperuserNow 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