Home / File/ user.js — express Source File

user.js — express Source File

Architecture documentation for user.js, a javascript file in the express codebase.

Entity Profile

Relationship Graph

Source Code

'use strict'

module.exports = User;

// faux model

function User(name, age, species) {
  this.name = name;
  this.age = age;
  this.species = species;
}

User.all = function(fn){
  // process.nextTick makes sure this function API
  // behaves in an asynchronous manner, like if it
  // was a real DB query to read all users.
  process.nextTick(function(){
    fn(null, users);
  });
};

User.count = function(fn){
  process.nextTick(function(){
    fn(null, users.length);
  });
};

// faux database

var users = [];

users.push(new User('Tobi', 2, 'ferret'));
users.push(new User('Loki', 1, 'ferret'));
users.push(new User('Jane', 6, 'ferret'));
users.push(new User('Luna', 1, 'cat'));
users.push(new User('Manny', 1, 'cat'));

Domain

Subdomains

Functions

Frequently Asked Questions

What does user.js do?
user.js is a source file in the express codebase, written in javascript. It belongs to the ExpressCore domain, ApplicationInit subdomain.
What functions are defined in user.js?
user.js defines 1 function(s): User.
Where is user.js in the architecture?
user.js is located at examples/view-locals/user.js (domain: ExpressCore, subdomain: ApplicationInit, directory: examples/view-locals).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free