Created
August 16, 2016 13:46
-
-
Save savelee/890fa9ea7dc15c3cde87a20706436d66 to your computer and use it in GitHub Desktop.
users/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
/* | |
* This is the Users class, for now it doesn't do anything then outputing data. | |
* | |
* @example | |
* UsersService = require('./users'); | |
* us = new UserService() | |
* us.getData(request, response); | |
*/ | |
function UsersService() { | |
var me = this; | |
} | |
/** | |
* Retrieve user data | |
* @param {Express res} request | |
* @param {Express res} response | |
*/ | |
UsersService.prototype.getData = function(req, res){ | |
var args = req.params, | |
pars = req.query, | |
me = this; | |
res.set('Content-Type', 'application/javascript'); | |
var data = [ | |
{ | |
name: 'Lee Boonstra', | |
email: "lee@example.com", | |
phone: "555-111-1111" | |
}, | |
{ | |
name: 'Olga Petrova', | |
email: "olga@example.com", | |
phone: "555-222-1111" | |
}, | |
{ | |
name: 'Danny McLaughlin', | |
email: "danny@example.com", | |
phone: "555-333-1111" | |
}, | |
{ | |
name: 'Ellen Fischer', | |
email: "ellen@example.com", | |
phone: "555-444-1111" | |
} | |
]; | |
res.jsonp(data); | |
}; | |
module.exports = UsersService; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment