Skip to content

RESTFul CRUD Example with Node.js and Mysql (Express framework)

Notifications You must be signed in to change notification settings

krguptaa/rest-crud-nodejs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a very basic example of rest api in Node.js

Installation

*for newbies : Clone or download zip to your machine then hit this :

npm install

Steps for generating the package for node Js

  1. Create the Folder mkdir foldername
  2. initialize the package using npm npm init
  3. Provide the details like 'package name, version and description etc'
  4. package.json will created in folder

Install the express framework, mysql and body-parser

npm install express mysql body-parser --save

Create the server.js file

Start the node for running

node server.js

Configuration (database)

host: 'localhost',
user: 'root',
password : 'root',
port : 3306, //port mysql
database:'node'	

Below is the base url for rest api

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

About

RESTFul CRUD Example with Node.js and Mysql (Express framework)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published