Flask is used to serve all REST API requests, additionally it also serves the user interface.
All user data is stored on MongoDB Cloud Atlas and all book information is gathered from the NYT API. In order to run locally you need both a mongo.key
and nyt.key
file with their respective API keys in the api
folder.
Created namely for CoSchedule Coding Challenge V3.
View NYT Bestsellers on the Demo.
Below is a short description of the API.
Signup
/api/signup/
uname
: usernamepword
: password
Returns with response relating whether there was a successful signup. Additionally, if a successful signup occured the user will atain an authentication key.
Login
/api/login/
uname
: usernamepword
: password
Returns with response relating whether there was a successful login. Additionally, if a successful login occured the user will atain an authentication key.
Explore
/api/explore/
page_number
: integer you are requestingcategory
: category being requested
Returns with response relating whether addition of rating occured or not.
Get Book
/api/getbook/
isbn
: ISBN of book we're looking for
Get book information from ISBN from our database.
Search
/api/search/
searchterm
: some string that might work
Returns list of books
VIDEO DEMO:
Rate
/api/rate/
uname
: usernameakey
: authentication keyisbn
: isbn number of book your review under itreview
: string with intended review in itrating
: integer between 1 and 10
Returns with response relating whether addition of rating occured or not.
VIDEO DEMO:
Delete Rating
/api/deleterating/
uname
: usernameakey
: authentication keyisbn
: isbn number of book your review under it
Returns with response relating whether deletion of rating occured or not.
VIDEO DEMO:
Comment
/api/comment/
uname
: usernameakey
: authentication keyisbn
: isbn number of book with comment of review under itreview_uname
: username of reviewer you commented undercomment
: comment content you are adding
Returns with response relating whether deletion occured or not.
VIDEO DEMO:
Delete Comment
/api/deletecomment/
uname
: usernameakey
: authentication keyisbn
: isbn number of book with comment of review under itreview_uname
: username of reviewer you commented undercomment
: comment content you are deleting
Returns with response relating whether deletion occured or not.
VIDEO DEMO:
Alter Comment
/api/altercomment/
uname
: usernameakey
: authentication keyisbn
: isbn number of book with comment of review under itreview_uname
: username of reviewer you commented undercomment
: comment content you are alteringupdated_comment
: updated comment content you are altering too
Returns with response relating whether success occured or not.
Ping
/api/ping/
pong
Setup the device by getting the respective api keys for your MongoDB Cloud Atlas database (mongo.key
) and NYT Best Sellers API (nyt.key
) and placing them into the api
folder.
Ensure that MongoDB can connect to your service by adding the services IP address to the MongoDB Cloud Atlas Network Atlas list.
Run test environment (non-production) with py -3 -m flask_app
. Or run in production with normal production setup process.
I currently have a slightly modified version of the flask code running on a premium PythonAnywhere account: link to website.
- Create API
- End point username / password
- Allow searching the data source
- Allow rating system
- Add
- Delete
- View
- Edit
- Comment system
- Create UI
- End point username / password
- Allow searching the data source
- Allow rating system
- Add
- Delete
- View
- Edit
- Comment system
- API
- Cloud hosting
- MongoDB Cloud Atlas for Database
- PythonAnywhere for Flask Service
- Optimization
- Cloud hosting
- UI
- Optimization
- Better Styling
- Search result highlighting
- Dark theme switcher