Skip to content

sibStephen/Mint-REST

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mint-REST

A simple rest api using Node.js , MongoDB , Express and Mongoose as the ORM. Specially designed for blogging platforms and social netwroks.

Overview

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"

Prerequisites

  • NodeJS
  • MongoDB server
  • MongoDB query browser for speed developing.

Setting up the app

Run npm install at the root folder to download dependencies. And make sure your MongoDB server is running.

Configuration

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.

Api documentation

Signup URL

http://localhost:3000/api/signup This is the object have to passed.

{
 name: "",
 username: "",
 email: "",
 password: ""
}

Login URL

http://localhost:3000/api/login

{
username: "",
password: ""
}

Users get all URL

http://localhost:3000/api/users

Stories get all URL

http://localhost:3000/api/stories

Get specific story with story ID URL

http://localhost:3000/api/story?id=1

Delete specific story with story ID URL

http://localhost:3000/api/remove_story?id=1

Search specific story with story ID URL

http://localhost:3000/api/search_story?query=mongo

Search stories according to category URL

http://localhost:3000/api/search_story_by_category?category=java

Search specific user with email URL

http://localhost:3000/api/[email protected]

To access following links, user must be logged into the system and has a token.

Create new story URL

http://localhost:3000/api/story

{
owner: "",
title: "",
content: "",
category: "",
publishStatus: ""
}

Get all stories according to user ID URL

http://localhost:3000/api/story_of_user

Update story URL

http://localhost:3000/api/update_story

{
owner: "",
title: "",
content: "",
category: "",
publishStatus: ""
}

References

http://projectslanka.blogspot.com/2015/10/create-restful-api-using-nodejs-part-2.html

About

A restful api using MongoDB , Node JS and Express

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 84.7%
  • HTML 15.3%