Giter Club home page Giter Club logo

hello-books-api's Introduction

Hello-Books-API

Build Status Maintainability Coverage Status

Hello-Books-APi is a library management API. It help in management and tracking of books and users who interact with the library's books. The API also enable new users to register while existing users can login. Users can also reset their password and borrow books. The API functionality and the respective endpoints include the following:

  • To view documentation click here.
Endpoints and methods Functionality Authorized
/api/v1/books (POST) Add a book Admin only
/api/v1/books/bookId(PUT) Modify a book’s information Admin only
/api/v1/books/bookId(DELETE) Remove a book Admin only
/api/v1/books(GET) Retrieves all books Everybody
/api/v1/books/book_id(GET) Get a book Everybody
/api/v1/users/books/book_id(POSt) Borrow a book logged in User and Admin
/api/v1/auth/register(POST) Register a user Everybody
/api/v1/auth/register(PUT) Upgrade a user to admin Admin only
/api/v1/auth/register(GET) Get registered users Admin only
/api/v1/auth/login(POST) Login a user Registered user
/api/v1/auth/logout(POST) Logout a user Loggged in user
/api/v1/auth/reset-password(POST) Reset a user Password Registered user
/api/v1/users/books/book_id(POST) Borrow a books Logged in user
/api/v1/users/books/book_id(PUT) Return a books Logged in user
/api/v1/users/books(GET) Get user borrowing history Logged in user

Running and Testing of the API

Prequisites

Python - version 3.6.4
Postgress database
postman - To run various endponts

Installing

Perform the following simple steps:

  • Open git and navigate to directory yo which to run the app from.

  • Git clone the this repository using either.

    • Using SSH:

      [email protected]:sam-karis/Hello-Books-API.git

    • Using HTTP:

      https://github.com/sam-karis/Hello-Books-API.git

  • Set up a virtual eniviroment for reference click here.

  • Activate the virtualenv on your terminal

  • Now install the apps dependencies by running pip install -r requirements.txt

  • Create databaseand set global variables on the terminal

    • For database set DATABASE_URL= 'yourdatabaseurl'
    • For email sending
      Email='[email protected]'
      Username='yourusername'
      Password='dmy_password'
  • Run manage.py to create database tables as below
    python manage.py db init
    python manage.py db migrate
    python manage.py db upgrade

  • Set the following configuration on terminal to run the appFLASK_CONFIG=development, FLASK_APP=run.py

  • Then run flask run to launch the localhost.

  • Lastly with the app running access the endpoints using postman.

While working with postman use the following attributes:

  • For adding and editing books - title, description, edition, author
  • User registration - name, email ,password
  • User login - email , password
  • User logout, borrow and returnbook, - email
  • User reset password - email, new_password

Tests Hello-Books-API has automated test(unittest) to check if it the endpoints work as expected. To run the tests activate the virtual environment and then run nosetests --with-coverage

To contribute to this work

Fork the repository from links shared above and make a pull request.

hello-books-api's People

Contributors

sam-karis avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.