Skip to content
Myr

index.js

This file

Path

examples/jade/index.js

51 lines · 1.1 KiB · JavaScript

Last changed by

Not known.

History of this file

Take it

The walk stopped after 200 commits: lines older than 6bc7574 point at it.

docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574

lines 1–51why, one step back
1/**
2 * Module dependencies.3 */45var express = require('../../lib/express');67// Path to our public directory89var pub = __dirname + '/public';1011// setup middleware1213var app = express();14app.use(express.static(pub));1516// Optional since express defaults to CWD/views1718app.set('views', __dirname + '/views');1920// Set our default template engine to "jade"21// which prevents the need for extensions22// (although you can still mix and match)23app.set('view engine', 'jade');2425function User(name, email) {26 this.name = name;27 this.email = email;28}2930// Dummy users31var users = [32 new User('tj', 'tj@vision-media.ca')33 , new User('ciaran', 'ciaranj@gmail.com')34 , new User('aaron', 'aaron.heckmann+github@gmail.com')35];3637app.get('/', function(req, res){38 res.render('users', { users: users });39});4041// change this to a better error handler in your code42// sending stacktrace to users in production is not good43app.use(function(err, req, res, next) {44 res.send(err.stack);45});4647/* istanbul ignore next */48if (!module.parent) {49 app.listen(3000);50 console.log('Express started on port 3000');51}