Code Monkey home page Code Monkey logo

node-book-api's Introduction

Node JSON API logo

An advanced, production-grade Node JSON API with CRUD functionalities🚩


Contributions welcome License: MIT


API Documentation 📝

Indices


Authentication

Contains ALL routes for user authentication (register, login, reset password, etc).

1. Forgot Password

Generate password token & send a reset URL email to the email address if valid.

Endpoint:

Method: POST
Type: RAW (JSON)
URL: https://json-node-api.herokuapp.com/api/v1/auth/forgotPassword/

Headers:

Key Value Description
Content-Type application/json JSON Content Type

Body:

{
    "email": "[email protected]"
}

2. Get Logged In User Details

Get the details of the current logged in user. This can be helpful when user details are required in a Front-End with any CRUD action.

Endpoint:

Method: GET
URL: https://json-node-api.herokuapp.com/api/v1/auth/me/

3. Login User

Validates the credentials passed in. Returns a JWT token & cookie.

Endpoint:

Method: POST
Type: RAW (JSON)
URL: https://json-node-api.herokuapp.com/api/v1/auth/login/

Headers:

Key Value Description
Content-Type application/json JSON Content Type

Body:

{
    "email": "[email protected]",
    "password": "Qwert0"
}

4. Logout User

Clears out token cookie.

Endpoint:

Method: GET
URL: https://json-node-api.herokuapp.com/api/v1/auth/logout/

5. Register User

Creates a user if account with email address sent is non-existing. Returns a JWT token & cookie.

Endpoint:

Method: POST
Type: RAW (JSON)
URL: https://json-node-api.herokuapp.com/api/v1/auth/register/

Headers:

Key Value Description
Content-Type application/json JSON Content Type

Body:

{
    "firstName": "John",
    "lastName": "Doe",
    "email": "[email protected]",
    "password": "Qwert0"
}

6. Reset Password

Checks if the reset token sent is valid & updates the validated password respectively.

Endpoint:

Method: PUT
Type: RAW (JSON)
URL: https://json-node-api.herokuapp.com/api/v1/auth/resetPassword/8a9f8b89881ad27f0cb0150f2ede3ef15115fc25

Headers:

Key Value Description
Content-Type application/json JSON Content Type

Body:

{
    "password": "Qwert0"
}

Books

Books CRUD functionality. This includes routes for

  • Getting all books
  • Getting a single book
  • Adding a book
  • Updating a book
  • Deleting a book

1. Add A Book

Endpoint:

Method: POST
Type: RAW (JSON)
URL: https://json-node-api.herokuapp.com/api/v1/books/

Headers:

Key Value Description
Content-Type application/json JSON Content Type

Body:

{
    "title": "The Debugger",
    "price": 10.99,
    "author": "Omezibe Obioha",
    "datePublished": "06-09-2021",
    "pages": 153,
    "publisher": "Diamonds Books 💎",
    "description": "This book talks about the \"adventures\" of the author in his programming journey so far: the good, bad, and ugly.",
    "isbn": "9876543210"
}

2. Delete A Book

Endpoint:

Method: DELETE
URL: https://json-node-api.herokuapp.com/api/v1/books/e297d1d4-8050-4368-85c2-75aa7e8c5c04/

3. Get A Book

Endpoint:

Method: GET
URL: https://json-node-api.herokuapp.com/api/v1/books/e297d1d4-8050-4368-85c2-75aa7e8c5c05/

4. Get All Books

Endpoint:

Method: GET
URL: https://json-node-api.herokuapp.com/api/v1/books/

Query Params:

Key Value Description
select title,author,price,isbn Allows you to select the fields you want the API to send. By default, ALL fields are sent. Also, the "id" field can't be deselected.
limit 5 Sets the number of records the APi sends per request. The default value is 5.
page 1 Allows to navigate to a "page" to get the next or previous set of records as required. The default value is 1.

5. Update A Book

Endpoint:

Method: PUT
Type: RAW (JSON)
URL: https://json-node-api.herokuapp.com/api/v1/books/e297d1d4-8050-4368-85c2-75aa7e8c5c05/

Headers:

Key Value Description
Content-Type application/json JSON Content Type

Body:

{
    "title": "Purple Hibiscus (Revised Edition)"
}

Back To Top ↺

Made with ♥ by Omzi

node-book-api's People

Contributors

omzi avatar

Stargazers

Somtozech avatar  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.