- Backend for LibrarIST android app developed for CMU course at IST Lisbon. Repository for the app can be found here.
pip install flask-restful
pip install SQLAlchemy Flask-SQLAlchemy
pip install virtualenv
pip install flask flask-jsonpify flask-sqlalchemy
virtualenv venv
source venv/bin/activate
pip freeze
#I am using SQLlite, you can download easy db editor/viewer from https://sqlitebrowser.org/
sqlite3 libraist.db
flask --app server run
FLASK_APP=server.py nohup flask run --host=0.0.0.0 > log.txt 2>&1
http://100.68.28.175:5000 /books -- to get all books
http://100.68.28.175:5000 /books/metered - to get all books for metered connection
http://100.68.28.175:5000 /libs - to get all libraries
http://100.68.28.175:5000 /libs/metered - get libraries for metered connection
http://100.68.28.175:5000 /books_in_library/<library_id> - get all books in library
http://100.68.28.175:5000 /available_books_in_library/<library_id> - get available books in library
http://100.68.28.175:5000 /get_libraries_by_book_title ? title = %22 name %20 name %22
http://100.68.28.175:5000 /get_libraries_by_book_barcode ? barcode = %22 barcode %22
http://100.68.28.175:5000 /get_library_by_name ? name = %22 name %20 name %22. // %20 - space; %22 - quotes symbol
http://100.68.28.175:5000 /get_book_by_barcode ? barcode = %22 barcode %22
http://100.68.28.175:5000 /get_book_by_title ? title = %22 name %20 name %22
http://100.68.28.175:5000 /search ? search = "what" & offset = 2 & limit = 2
Examples:
http://127.0.0.1:5000/get_library_by_name?name=%22Sao%20Sebastao%22
http://127.0.0.1:5000/get_book_by_title?title=%22Flask101%22
http://100.68.28.175:5000/get_libraries_by_book_barcode/?barcode=%221000%22
http://100.68.28.175:5000/get_libraries_by_book_barcode/?barcode=%221000%22
can be made to localhost on https://reqbin.com/
Example: for http://127.0.0.1:5000 /books
{
"barcode":" id "
"title": "Narnia- the Lion the witch and the wardrobe",
"author": "C.S.Lewis",
"photo": "string",
}
//Note: barcode is a uuid generated string, so there is no need to include it
http://100.68.28.175:5000 /libs
{
"id":"id"
"name": "string",
"location":"string",
"photo":"string",
}
//Note: id is a uuid generated string, so there is no need to include it
http://100.68.28.175:5000. /libs/edit ? id= %22 <library_id> %22
Example:
http://127.0.0.1:5000/libs/edit?id="1"
{
"name":"Alameda",
"location":"37.765206;-122.241636",
"photo":""
}
POST request
http://100.68.28.175:5000 /checkin/ - update book availability to 1
Example for check out:
{
"id":"id",
"bookCode": "1000",
"libraryId":""
}
PUT request http://100.68.28.175:5000 **/checkout? barcode= & libraryId= & id= ** - update book availability to 0