user.js
This file
Path
examples/view-locals/user.js
31 lines · 570 bytes · JavaScript
Last changed by
Not known.
History of this fileTake it
The walk stopped after 200 commits: lines older than 6bc7574 point at it.
docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574
lines 1–31why, one step back1module.exports = User;23// faux model45function User(name, age, species) {6 this.name = name;7 this.age = age;8 this.species = species;9}1011User.all = function(fn){12 process.nextTick(function(){13 fn(null, users);14 });15};1617User.count = function(fn){18 process.nextTick(function(){19 fn(null, users.length);20 });21};2223// faux database2425var users = [];2627users.push(new User('Tobi', 2, 'ferret'));28users.push(new User('Loki', 1, 'ferret'));29users.push(new User('Jane', 6, 'ferret'));30users.push(new User('Luna', 1, 'cat'));31users.push(new User('Manny', 1, 'cat'));