GithubHelp home page GithubHelp logo

bookstore-api's Introduction

bookstore-api

About the project:

Project created to practice my studies about how create REST APIs. GitHub license GitHub issues

Tech Stack

Server: Node.js, Javascript, Express, MySQL, Sequelize

Environment variables

โš™๏ธ Set the environment variables to the Sequelize communicate with the database server

DBUSER=
DBNAME=
DBPASS=
DBHOST= localhost
DBDIALECT= mysql

How to run the project:

Install all the dependecies:

npm install

๐Ÿ’ก Turn on the MySQL server

Create the database with the sequelize

npx sequelize db:create

Create the database table with the sequelize

npx sequelize db:migrate

Run all the seeders to seed the database book table

npx sequelize db:seed:all

After install all the dependecies, create the database, database table and run all the seeders, we can start the server

npm start

API Reference

/bookstore/api/v1

Return all the books

  GET /bookstore/api/v1/books

Get a book by id

  GET /bookstore/api/v1/books/{id}
Parameter Type Description
id string Required. Id of item to fetch

Create a new book

  POST /bookstore/api/v1/books
Parameter Type Description
title string Required
total_pages integer Required
author string Required
release_year string Required
stock integer Required

Update a existing book

  PUT /bookstore/api/v1/books/{id}
Parameter Type
title string
total_pages integer
author string
release_year string
stock integer

Destroy a existing book

  DELETE /bookstore/api/v1/books/{id}

Sucess code:

  • 200: Ok
  • 201: Created

Errors code:

  • 400: Bad request
  • 404: Not found
  • 422: Unprocessable entity
  • 500: Internal server error

bookstore-api's People

Contributors

wendelcutrim 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.