Show Menu
Cheatography

Express Cheat Sheet (DRAFT) by

Based on Express 4

This is a draft cheat sheet. It is a work in progress and is not finished yet.

General

var express = requir­e('­exp­ress');
var app = express();

Applic­ation

app.lo­cal­s.title / strftime / email
app.al­l(path, callback) 
app.us­e([­path], callback) 
app.ge­t(path, callback) 
app.po­st(­path, callback) 
app.pu­t(path, callback) 
app.de­let­e(path, callback) 
app.en­abl­e(name)
: Set to True
app.di­sab­le(­name)
: Set to False
app.en­abl­ed(­name)
: True if name is True
app.di­sab­led­(name)
: True if name is False
app.en­gin­e(ext, callback)
app.li­ste­n(path, callback) 
app.pa­ram­([n­ame], callback) 
app.re­nde­r(view, [locals], callback) 
app.ro­ute­(path) 
app.se­t(name, value) 
app.ge­t(name) 
 

Request properties

req.ba­seUrl
req.path
req.or­igi­nalUrl
: req.ba­seUrl + req.path
req.body
: Require MW body-p­arser & multer
req.co­okies
: Require MV cookie­-parser
req.si­gne­dCo­okies
: Require MV cookie­-parser
req.fresh
req.stale
req.ho­stname
req.ip
: X-Forw­ard­ed-For
req.method
GET / POST / PUT / DELETE ...
req.params
Properties named route parameters
req.pr­otocol
req.query
req.route
req.secure
: TLS connection
req.su­bdo­mains
req.xhr
: X-Requ­est­ed-With

Request methods

 
 

Response properties

 

Response methods