Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hir4/mongoose_api
Project using Node, Express and Mongoose to create an API that access MongoDB database and make all the CRUD operations.
https://github.com/hir4/mongoose_api
api-rest crud dotenv express javascript mongodb mongoose nodejs nodemon
Last synced: 13 days ago
JSON representation
Project using Node, Express and Mongoose to create an API that access MongoDB database and make all the CRUD operations.
- Host: GitHub
- URL: https://github.com/hir4/mongoose_api
- Owner: Hir4
- Created: 2022-01-27T12:58:22.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-01-27T19:20:08.000Z (almost 3 years ago)
- Last Synced: 2024-11-07T03:41:02.648Z (2 months ago)
- Topics: api-rest, crud, dotenv, express, javascript, mongodb, mongoose, nodejs, nodemon
- Language: JavaScript
- Homepage:
- Size: 43.9 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Mongoose API
## :dart: About ##
Project using Node, Express and Mongoose to create an API that access MongoDB database and make all the CRUD operations.
## :rocket: Technologies ##
- [Node]
- [Express]
- [Mongoose]## :white_check_mark: Prerequisite ##
Before start and assuming that you already clone the repository, if not you can run:
```bash
git clone https://github.com/Hir4/mongoose_api.git && cd mongoose_api
```
After that, it is time to install the dependencies by running:
```bash
npm install
```## :checkered_flag: Running
Now we are ready to go and run with nodemon, if you want you can change the script in package.json:
```bash
npm run server
```
or without:
```bash
node server.js
```## :world_map: Routes
### `GET '/'`
Await find all clients and response:
```json
[
{
"_id": ,
"name": ,
"age": ,
"salary": ,
"__v":
}
]
```
Status can be: 200(everything ok) or 500(something went wrong in the server)### `GET '/:id'`
Await find by id the client and response:
```json
[
{
"_id": ,
"name": ,
"age": ,
"salary": ,
"__v":
}
]
```
Status can be: 200(everything ok), 404(id not found) or 500(something went wrong in the server)### `POST '/'`
Await to create a new client and response:
```json
[
{
"_id": ,
"name": ,
"age": ,
"salary": ,
"__v":
}
]
```
Status can be: 201(something was created) or 400(user did something wrong)### `PATCH '/:id'`
Await to update a specific parte of the client and response:
```json
[
{
"_id": ,
"name": ,
"age": ,
"salary": ,
"__v":
}
]
```
Status can be: 200(everything ok), 400(user did something wrong), 404(id not found) or 500(something went wrong in the server)### `DELETE '/:id'`
Await to remove the client and response:
```json
{
"message":
}
```
Status can be: 200(everything ok), 404(id not found) or 500(something went wrong in the server)