https://github.com/siopipin/resfullapi-express-mongo
Restfull api on express js with mongodb and mongose
https://github.com/siopipin/resfullapi-express-mongo
javascript mongodb mongoose nodejs resfull-api rest-api
Last synced: over 1 year ago
JSON representation
Restfull api on express js with mongodb and mongose
- Host: GitHub
- URL: https://github.com/siopipin/resfullapi-express-mongo
- Owner: siopipin
- Created: 2019-04-05T14:47:13.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-04-05T14:48:23.000Z (over 7 years ago)
- Last Synced: 2025-01-07T21:37:09.172Z (over 1 year ago)
- Topics: javascript, mongodb, mongoose, nodejs, resfull-api, rest-api
- Language: JavaScript
- Size: 23.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# RESTful API with Node.js, Express.js, Mongoose and MongoDB.
Example of a RESTful API built with Node.js, Express.js, Mongoose and MongoDB.
## RESTful API endpoints
### GET `/api/items`
Get all items.
+ Method: `GET`
+ URL: `/api/items`
### POST `/api/items`
Create a new item.
+ Method: `POST`
+ URL: `/api/items`
+ Body:
```js
{
"id": "1",
"name": "React.js Essentials",
"description": "A fast-paced guide to designing and building scalable and maintainable web apps with React.js.",
"quantity": "10"
}
```
### GET `/api/items/:itemId`
Get item with specific id.
+ Method: `GET`
+ URL: `/api/items/1`
### PUT `/api/items/:itemId`
Update entire item with specific id.
+ Method: `PUT`
+ URL: `/api/items/1`
+ Body:
```js
{
"id": "1",
"name": "React.js Essentials",
"description": "A fast-paced guide to designing and building scalable and maintainable web apps with React.js.",
"quantity": "20"
}
```
### PATCH `/api/items/:itemId`
Update part of the item with specific id.
+ Method: `PATCH`
+ URL: `/api/items/1`
+ Body:
```js
{
"quantity": "30"
}
```
### DELETE `/api/items/:itemId`
Delete item with specific id.
+ Method: `DELETE`
+ URL: `/api/items/1`
## Install
`npm install`
## Run
0. Make sure MongoDB is running, if not: `sudo ~/mongodb/bin/mongod` (assuming you have `~/mongodb` directory).
1. `npm run start`