Giter Site home page Giter Site logo

bookshelf-api's Introduction

Bookshelf-API

API to integrate for a bookshelf management system

Install and Run

Type npm install on the terminal to install all the node dependencies

After that, type npm run dev to start the node development server.

Project Description:

It is a book management system. Where users can authenticate. After signing in, users can add, edit, delete book info. Book list and details can be seen publicly.

User authentication API

  • Signup
  • Login

Book management API

  • Add book
  • Edit book
  • Delete book
  • Get book list
  • Get book details

Usage

User

Signup

To signup a new user send a POST request to the route /users/signup with the data as following JSON format:

{
    "name": "name",
    "email": "email",
    "password": "password",
    "mobile": "mobile"
} 

The mobile field is optional here.

Login

To login an existing user, send a POST request to route /users/login with the data as following JSON format:

{
    "email": "email",
    "password": "password"
}

For SIGNUP and LOGIN, both cases an authentication token is given to user, to authenticate a user for some operations.

Update (Authentication REQUIRED)

A logged in user can update his information. To update send a PATCH request to route /users with the necessary data to update as JSON format (same JSON format as SIGNUP request). The data can contain the following properties:

  • name
  • email
  • password
  • mobile

Fetch all existing user (OPTIONAL)

To view the list of registered user, send a GET request to the route /users. It will return the public profile information of the users.

Fetch the list of books of a user (Authentication REQUIRED)

To view the list of books of a user, send a GET request to the route /users/books. It will response with a book list of the logged in user.

Book

Getting all book list

To fetch the full list of books, send a GET request to the route /books. It will response with the full book list.

User can also pass some sorting queries to the URL to perform sorting on response data. In that case, send a GET request to the route /books/?sortBy=<key>:<type>. Replace the <key> with the property name, on which the search will execute based on. Also, replace <type> either with asc or desc keyword. asc is for assending sort and desc is for descending.

Fetch a specific book details

To fetch a specific book details, send a GET request to the route /books/:id. Here replace :id with the ObjectID of that specific book user want to fetch.

Add a new book (Authentication REQUIRED)

An existing user can add a new book into the collection. While logged in, send a POST request to the route /books with the data as following JSON format:

{
    "name": "book name",
    "author": "author",
    "publication": "publication",
    "year": "year of publication"
}

The year field is optional here.

Update a book information (Authentication REQUIRED)

A logged in user can update any of his book information. To update, send a PATCH request to route /books/:id with the necessary data to update as JSON format (same JSON format as Add new book request). The data can contain the following properties:

  • name
  • author
  • publication
  • year

Delete a book (Authentication REQUIRED)

A logged in user can delete any of his book. While logged in, send a DELETE request to the route /books/:id, where :id is the ObjectID of that specific book user wants to delete. User will get the deleted book information in response.

NOTE

  • User can use Postman to test the Bookshelf-API until it's integrated into an app.
  • For authentication using Postman, send the user authentication token in the request header as Authorization: Bearer <token> along with the request body. Replace <token> with the registered user token.

bookshelf-api's People

Contributors

nayeem-xtreme avatar

Stargazers

 avatar

Watchers

 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.