Skip to content

Commit

Permalink
Added apidoc
Browse files Browse the repository at this point in the history
  • Loading branch information
tanmoythander committed Feb 8, 2018
1 parent 18eb90f commit 67818d7
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/
apidoc/
npm-debug.log
6 changes: 6 additions & 0 deletions apidoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "Node REST Server",
"version": "0.0.1",
"description": "REST API documentation for Node REST Server",
"title": "API Documentation - Node REST Server"
}
76 changes: 76 additions & 0 deletions routes/token.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,23 @@ var createHash = function(password){
};


/**
* @api {post} /user/login User Login
* @apiVersion 0.0.1
* @apiGroup Authentication
* @apiName UserLogin
* @apiExample Example usage:
* url: http://localhost:3484/user/login
*
* body:
* {
* "email": "example@example.com",
* "pass": "thisIsPassword"
* }
*
* @apiParam {String} email Users email.
* @apiParam {String} pass Users password.
*/
router.route('/user/login')
.post(function(req, res) {
User.findOne({ "email" : req.body.email }, function(err, user) {
Expand Down Expand Up @@ -62,6 +79,27 @@ router.route('/user/login')
});
});

/**
* @api {post} /user/signup User Signup
* @apiVersion 0.0.1
* @apiGroup Authentication
* @apiName UserSignup
* @apiExample Example usage:
* url: http://localhost:3484/user/signup
*
* body:
* {
* "name": "John Doe",
* "email": "example@example.com",
* "dob": "Thu Dec 16 1971 00:00:00 GMT+0600 (+06)",
* "pass": "thisIsPassword"
* }
*
* @apiParam {String} name Users name.
* @apiParam {String} email Users email.
* @apiParam {Date} dob Users date of birth.
* @apiParam {String} pass Users password.
*/
router.route('/user/signup')
.post(function(req, res) {
User.findOne({ "email": req.body.email }, function(err, user) {
Expand Down Expand Up @@ -114,6 +152,23 @@ router.route('/user/signup')
});
});

/**
* @api {post} /admin/login Admin Login
* @apiVersion 0.0.1
* @apiGroup Authentication
* @apiName AdminLogin
* @apiExample Example usage:
* url: http://localhost:3484/admin/login
*
* body:
* {
* "email": "example@example.com",
* "pass": "thisIsPassword"
* }
*
* @apiParam {String} email Admins email.
* @apiParam {String} pass Admins password.
*/
router.route('/admin/login')
.post(function(req, res) {
Admin.findOne({ "email" : req.body.email }, function(err, admin) {
Expand Down Expand Up @@ -158,6 +213,27 @@ router.route('/admin/login')
});
});

/**
* @api {post} /admin/signup Admin Signup
* @apiVersion 0.0.1
* @apiGroup Authentication
* @apiName AdminSignup
* @apiExample Example usage:
* url: http://localhost:3484/admin/signup
*
* body:
* {
* "name": "John Doe",
* "email": "example@example.com",
* "dob": "Thu Dec 16 1971 00:00:00 GMT+0600 (+06)",
* "pass": "thisIsPassword"
* }
*
* @apiParam {String} name Admins name.
* @apiParam {String} email Admins email.
* @apiParam {Date} dob Admins date of birth.
* @apiParam {String} pass Admins password.
*/
router.route('/admin/signup')
.post(function(req, res) {
Admin.findOne({ "email": req.body.email }, function(err, admin) {
Expand Down

0 comments on commit 67818d7

Please sign in to comment.