Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/robincher/nodejs-api-demo
Demo API built with Node.js
https://github.com/robincher/nodejs-api-demo
nodejs rest
Last synced: about 1 month ago
JSON representation
Demo API built with Node.js
- Host: GitHub
- URL: https://github.com/robincher/nodejs-api-demo
- Owner: robincher
- License: unlicense
- Created: 2018-09-02T10:53:08.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-02-28T02:07:29.000Z (over 1 year ago)
- Last Synced: 2023-03-01T10:51:58.665Z (over 1 year ago)
- Topics: nodejs, rest
- Language: JavaScript
- Size: 271 KB
- Stars: 0
- Watchers: 1
- Forks: 3
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Node API Demo
[![Build Status](https://travis-ci.org/robincher/nodejs-api-demo.svg?branch=master)](https://travis-ci.org/robincher/nodejs-api-demo)
Demo REST API built with Node.js and OpenAPI (Swagger) documentation.
## Tech Stack
- Node.js 10.14.x
- NPM Libraries
- Nodemon for Debugging and keeping track of changed files
- Express for initiating the server
- Mongoose for interracting with MongoDB
- BodyParser to parse request body
- MongoDB 4.0 (Docker container recommended)## Walkthrough
### Set-up Mongo Docker (Recommended)
```
docker pull mongodocker run -p 27017:27017 -v ~/data/db:/data/db --name mongodb -d mongo
```### Starting the REST API Server
```
npm start run
```View the OpenAPI documentation @ http://localhost:3000/api-docs
### Create a sample task
```
curl -X POST \
http://localhost:3000/tasks \
-H 'Accept: */*' \
-H 'Accept-Encoding: *' \
-H 'Content-Type: application/json' \
-H 'Host: localhost:3000' \
-d '{
"name" : "Do something",
"status" : "pending"
}'
```## Reference
- [Codementor Tutorial](https://www.codementor.io/olatundegaruba/nodejs-restful-apis-in-10-minutes-q0sgsfhbd)
- [Implementing Swagger](https://github.com/Mobecom/JSDoc-Swagger-Washywashy)