Skip to content
This repository has been archived by the owner on Jan 30, 2022. It is now read-only.

junwatu/rest-node-mongoose-mongodb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Node.js - Mongoose - MongoDB

Silly REST app using Node.js, Express, Mongoose and MongoDB database.

Install

Make sure MongoDB database server is running then

$ cd rest-node-mongoose-mongodb
$ npm install
$ node app.js

REST

REST operation can be tested using ordinary curl or best with httpie. Ok l am using httpie because it has better format for json data.

###GET

Get all persons data

$ http localhost:3300/persons

###PUT

Update data record. Example for username morbid_angel

$ http --json PUT localhost:3300/persons/morbid_angel name="Equan Pr." website=http://equan.me

###DELETE To delete record based on username

$ http DELETE localhost:3300/persons/morbid_angel

###POST

Create new person data

$ http --form POST localhost:3300/persons name="Anyone Yo" website=http://dude.com username=dude

Demo

Online Persons REST API service at http://persons-api.herokuapp.com/