Skip to content

Commit

Permalink
Clean up comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Louis Cheung committed Jun 5, 2015
1 parent e65e356 commit fff57be
Showing 1 changed file with 32 additions and 60 deletions.
92 changes: 32 additions & 60 deletions example/routes.js
Original file line number Diff line number Diff line change
@@ -1,77 +1,49 @@

/**
* @swagger
* resourcePath: /apiJs
* description: All about API
*/

/**
* @swagger
* path: /login
* operations:
* - httpMethod: POST
* summary: Login with username and password
* notes: Returns a user based on username
* responseClass: User
* nickname: login
* consumes:
* - text/html
* parameters:
* - name: username
* description: Your username
* paramType: query
* required: true
* dataType: string
* - name: password
* description: Your password
* paramType: query
* required: true
* dataType: string
*/
exports.login = function (req, res) {
var user = {};
user.username = req.param('username');
user.password = req.param('password');
res.json(user);
}

/**
* @swagger
* models:
* User:
* id: User
* properties:
* username:
* type: String
* password:
* type: String
*/

// ---------------------------------------------------------------------------------------------------------------------

'use strict';

/**
* Sets up the routes.
* @param {object} app - Express app
*/
module.exports.setup = function (app) {

/**
* @swagger
*/
app.get('/', rootHandler)

/**
* @swagger
* path: /login
* operations:
* - httpMethod: POST
* summary: Login with username and password
* notes: Returns a user based on username
* responseClass: User
* nickname: login
* consumes:
* - text/html
* parameters:
* - name: username
* description: Your username
* paramType: query
* required: true
* dataType: string
* - name: password
* description: Your password
* paramType: query
* required: true
* dataType: string
*/
app.get('/login', loginHandler);
}

/**
* @swagger
*
*/
function rootHandler(req, res) {
res.send('Hello World!');
});

/**
* @swagger
*
*/
function loginHandler(req, res) {
res.send('login');
var user = {};
user.username = req.param('username');
user.password = req.param('password');
res.json(user);
}

0 comments on commit fff57be

Please sign in to comment.