https://github.com/thiiagoms/node-mongodb
:leaves: :books: Books API with NodeJS and MongoDB
https://github.com/thiiagoms/node-mongodb
learning-by-doing learning-nodejs nodejs
Last synced: 4 months ago
JSON representation
:leaves: :books: Books API with NodeJS and MongoDB
- Host: GitHub
- URL: https://github.com/thiiagoms/node-mongodb
- Owner: thiiagoms
- Created: 2022-05-03T11:18:25.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-05-15T19:02:26.000Z (over 3 years ago)
- Last Synced: 2025-10-11T03:03:45.137Z (4 months ago)
- Topics: learning-by-doing, learning-nodejs, nodejs
- Language: JavaScript
- Homepage:
- Size: 99.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Book API with NodeJs, Express and Mongodb :four_leaf_clover: :books:
## Install
- First, clone the project:
```bash
$ git clone https://github.com/thiiagoms/node-express-mongodb
```
- Second, install dependencies:
```bash
$ cd node-express-mongodb
$ npm install
```
- Third, create `.env` and add your Mongo credentials in `.env` file:
```bash
$ cp .env.example .env
$ cat .env
DATABASE_HOST=
DATABASE_NAME=
DATABASE_USER=
DATABASE_PASS=
```
## 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