https://github.com/krguptaa/rest-crud-nodejs
RESTFul CRUD Example with Node.js and Mysql (Express framework)
https://github.com/krguptaa/rest-crud-nodejs
expressjs nodejs nodejs-mysql rest-api restful-api
Last synced: 8 days ago
JSON representation
RESTFul CRUD Example with Node.js and Mysql (Express framework)
- Host: GitHub
- URL: https://github.com/krguptaa/rest-crud-nodejs
- Owner: krguptaa
- Created: 2018-08-14T10:31:10.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-08-14T10:46:33.000Z (over 7 years ago)
- Last Synced: 2025-02-13T19:40:42.145Z (about 1 year ago)
- Topics: expressjs, nodejs, nodejs-mysql, rest-api, restful-api
- Language: JavaScript
- Size: 9.77 KB
- Stars: 1
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
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