Skip to content

thiiagoms/node-mongodb

Repository files navigation

Logo

Book API with NodeJs, Express and Mongodb 🍀 📚

Install

  • First, clone the project:
$ git clone https://github.com/thiiagoms/node-express-mongodb
  • Second, install dependencies:
$ cd node-express-mongodb
$ npm install
  • Third, create .env and add your Mongo credentials in .env file:
$ cp .env.example .env
$ cat .env

DATABASE_HOST=<your-mongo-host-here>
DATABASE_NAME=<your-mongo-dbname-here>
DATABASE_USER=<your-mongo-dbuser-here>
DATABASE_PASS=<your-mongo-dbass-here>

Run

  • Run dev mode with nodemon:
$ npm run dev

Endpoints

Books with author

  • GET - /books - Return all books with/without author
  • GET - /books/:id - Return single book with/without author`
  • POST - /books - Create new book
  • PUT - /books/:id - Update book
  • DELETE - /books/:id - Delete book

Author

  • GET - /books - Return all authors
  • GET - /books/:id - Return single author
  • POST - /books - Create new author
  • PUT - /books/:id - Update author
  • DELETE - /books/:id - Delete author

About

🍃 📚 Books API with NodeJS and MongoDB

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published