Sails.js

Sails.js is a great tool to generate a REST API in very fast way.

install sails

npm install sails -g

create new app

sails new sails-demo

create new module

sails generate api post

run the app

sails lift

go to new module

-> goto http://localhost:1337/
-> goto http://localhost:1337/post

this is boring white page, but this mean, REST is working!

Time to add some items

To add item you can use url or send json

Add item via url

http://localhost:1337/post/create?name=Lorem1&desc=Lorem ipusm
http://localhost:1337/post/create?name=Lorem2&desc=Lorem ipusm

Add item by sending json

http://localhost:1337/post/create
Content-Type  application/json; charset=utf-8
{
  "name": "Lorem",
  "desc": "Ipsum"
}

s6

Now posts list should be similar to

if you want update existing item use:

http://localhost:1337/post/update/22
Content-Type  application/json; charset=utf-8
{
  "name": "Lorem 22",
  "desc": "Ipsum 22"
}