This is a very basic example of rest api in Node.js
*for newbies : Clone or download zip to your machine then hit this :
npm install
- Create the Folder
mkdir foldername
- initialize the package using npm
npm init
- Provide the details like 'package name, version and description etc'
- package.json will created in folder
npm install express mysql body-parser --save
node server.js
host: 'localhost',
user: 'root',
password : 'root',
port : 3306, //port mysql
database:'node'
http://localhost:8080/
You might need to pay attention on this , as we're using REST
Route HTTP Verb Description
/todos GET Get All tasks
/todo POST Add new task
/todo/:id GET Get a task (for editing)
/todo/:id PUT Update a task
/todo/:id DELETE Delete a task