Skip to content

Instantly share code, notes, and snippets.

@savelee
Created August 16, 2016 13:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save savelee/890fa9ea7dc15c3cde87a20706436d66 to your computer and use it in GitHub Desktop.
Save savelee/890fa9ea7dc15c3cde87a20706436d66 to your computer and use it in GitHub Desktop.
users/index.js
'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