app.METHOD()

app.METHOD(path, callback [, callback ...]) Routes an HTTP request, where METHOD is the HTTP method of the request, such as GET, PUT, POST, and so on, in lowercase. Thus, the actual methods are app.get(), app.post(), app.put(), and so on. See below for the complete list. For more information, see the routing guide. Express supports the following routing methods corresponding to the HTTP methods of the same names: checkout copy delete get head lock merge mkactivity mkcol move m-search notify

app.locals

app.locals The app.locals object has properties that are local variables within the application. app.locals.title // => 'My App' app.locals.email // => 'me@myapp.com' Once set, the value of app.locals properties persist throughout the life of the application, in contrast with res.locals properties that are valid only for the lifetime of the request. You can access local variables in templates rendered within the application. This is useful for providing helper functions to templates, as

app.listen()

app.listen(port, [hostname], [backlog], [callback]) Binds and listens for connections on the specified host and port. This method is identical to Node’s http.Server.listen(). var express = require('express'); var app = express(); app.listen(3000); The app returned by express() is in fact a JavaScript Function, designed to be passed to Node’s HTTP servers as a callback to handle requests. This makes it easy to provide both HTTP and HTTPS versions of your app with the same code base, as the app

app.get()

app.get(path, callback [, callback ...]) Routes HTTP GET requests to the specified path with the specified callback functions. For more information, see the routing guide. You can provide multiple callback functions that behave just like middleware, except these callbacks can invoke next('route') to bypass the remaining route callback(s). You can use this mechanism to impose pre-conditions on a route, then pass control to subsequent routes if there’s no reason to proceed with the current route.

app.get()

app.get(name) Returns the value of name app setting, where name is one of strings in the app settings table. For example: app.get('title'); // => undefined app.set('title', 'My Site'); app.get('title'); // => "My Site"

app.engine()

app.engine(ext, callback) Registers the given template engine callback as ext. By default, Express will require() the engine based on the file extension. For example, if you try to render a “foo.pug” file, Express invokes the following internally, and caches the require() on subsequent calls to increase performance. app.engine('pug', require('pug').__express); Use this method for engines that do not provide .__express out of the box, or if you wish to “map” a different extension to the templat

app.enabled()

app.enabled(name) Returns true if the setting name is enabled (true), where name is one of the properties from the app settings table. app.enabled('trust proxy'); // => false app.enable('trust proxy'); app.enabled('trust proxy'); // => true

app.enable()

app.enable(name) Sets the Boolean setting name to true, where name is one of the properties from the app settings table. Calling app.set('foo', true) for a Boolean property is the same as calling app.enable('foo'). app.enable('trust proxy'); app.get('trust proxy'); // => true

app.disabled()

app.disabled(name) Returns true if the Boolean setting name is disabled (false), where name is one of the properties from the app settings table. app.disabled('trust proxy'); // => true app.enable('trust proxy'); app.disabled('trust proxy'); // => false

app.disable()

app.disable(name) Sets the Boolean setting name to false, where name is one of the properties from the app settings table. Calling app.set('foo', false) for a Boolean property is the same as calling app.disable('foo'). For example: app.disable('trust proxy'); app.get('trust proxy'); // => false