#Hello Books
Hello Books is a simple API that implements CRUD functionalities. Two knids of users can use this API. A normal user (non-admin) can register to be a user, login, view all books available, borrow a book and logout. The admin, in addition to what the normal user can do is also able to create a new book, edit or delete an existing book.
The following are functionalities enabled with this API:
Functionality | Endpoint |
---|---|
POST /api/books | add a book |
PUT /api/books/ | modify a book’s information |
DELETE /api//books/ | Remove a book |
GET /api/books | Retrieves all books |
GET /api/books/ | Get a book |
POST /api/users/books/ | Borrow a book |
POST /api/auth/register | Creates a user account |
POST /api/auth/login | Logs in a user |
POST /api/auth/logout | Logs out a user |
POST /api/auth/reset-password | Password reset |
-
Download & Install Python
- Download python from it's main site i.e (https://www.python.org/downloads/) and download it's latest version 3.6
- Install it and it's required packages. This guide will help a lot to set that: (http://docs.python-guide.org/en/latest/starting/installation/)
-
Clone the repository in which the project resides into your local machine
- This is the clone link from the repository on github: (https://github.com/loisameyo/books-app.git)
-
Virtual Environment Installation
- Install the virtual environment by typing:
pip install virtualenv
on your terminal
- Install the virtual environment by typing:
-
Create a virtual environment by running
virtualenv venv
. This will create the virtual environment in which you can run the project. -
Activate the virtual environment by running
venv/Scripts/activate
-
Enter the project directory by running
cd Desktop\books-api\books-app
-
Once inside the directory install the required modules
- Run
pip install -r requirements.txt
- Run
-
Inside the application folder run the run.py file:
- On the terminal type
python run.py
to start the application
To run the tests for the app, run;
- nosetests -v
- Loice Meyo