A simple rest api using Node.js , MongoDB , Express and Mongoose as the ORM. Specially designed for blogging platforms and social netwroks.
This rest api created for a simple blogging platform with all the rest api standards. And also used MongoDB and the database and Mongoose as the ORM. Because Mongoose has a very good support at MongoDB. And also we have used following npm packages to create this rest api in a useful and structural way.
- "bcrypt-nodejs": "0.0.3"
- "body-parser": "^1.14.0"
- "cors": "^2.7.1"
- "express": "^4.13.3"
- "jsonwebtoken": "^5.0.5"
- "mongoose": "^4.1.8"
- "morgan": "^1.6.1"
- NodeJS
- MongoDB server
- MongoDB query browser for speed developing.
Run npm install at the root folder to download dependencies. And make sure your MongoDB server is running.
See the config.js file for more configuration options. You can change your app's secreet key , MongoDB host and also app's default port.
http://localhost:3000/api/signup This is the object have to passed.
{
name: "",
username: "",
email: "",
password: ""
}
http://localhost:3000/api/login
{
username: "",
password: ""
}
http://localhost:3000/api/users
http://localhost:3000/api/stories
http://localhost:3000/api/story?id=1
http://localhost:3000/api/remove_story?id=1
http://localhost:3000/api/search_story?query=mongo
http://localhost:3000/api/search_story_by_category?category=java
http://localhost:3000/api/searchUserWithEmail?email=chanu1993@gmail.com
To access following links, user must be logged into the system and has a token.
http://localhost:3000/api/story
{
owner: "",
title: "",
content: "",
category: "",
publishStatus: ""
}
http://localhost:3000/api/story_of_user
http://localhost:3000/api/update_story
{
owner: "",
title: "",
content: "",
category: "",
publishStatus: ""
}
* clone/download repository
* npm install
* node app.es6.js
http://projectslanka.blogspot.com/2015/10/create-restful-api-using-nodejs-part-2.html