Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Callable

  • Express instance itself is a request handler, which could be invoked without third argument.

    Parameters

    Returns any

  • Parameters

    Returns any

Index

Properties

_router

_router: any

Used to get all registered routes in Express Application

all

all: IRouterMatcher<this>

Special-cased "all" method, applying the given route path, middleware, and callback to every HTTP method.

checkout

checkout: IRouterMatcher<this>

connect

connect: IRouterMatcher<this>

copy

copy: IRouterMatcher<this>

delete

delete: IRouterMatcher<this>

get

get: function & IRouterMatcher<this>

head

head: IRouterMatcher<this>

locals

locals: any

lock

lock: IRouterMatcher<this>

m-search

m-search: IRouterMatcher<this>

map

map: any

merge

merge: IRouterMatcher<this>

mkactivity

mkactivity: IRouterMatcher<this>

mkcol

mkcol: IRouterMatcher<this>

mountpath

mountpath: string | string[]

The app.mountpath property contains one or more path patterns on which a sub-app was mounted.

move

move: IRouterMatcher<this>

notify

notify: IRouterMatcher<this>

on

on: function

The mount event is fired on a sub-app, when it is mounted on a parent app. The parent app is passed to the callback function.

NOTE: Sub-apps will:

  • Not inherit the value of settings that have a default value. You must set the value in the sub-app.
  • Inherit the value of settings with no default value.

Type declaration

    • (event: string, callback: function): this
    • Parameters

      Returns this

options

options: IRouterMatcher<this>

patch

patch: IRouterMatcher<this>

post

post: IRouterMatcher<this>

propfind

propfind: IRouterMatcher<this>

proppatch

proppatch: IRouterMatcher<this>

purge

purge: IRouterMatcher<this>

put

put: IRouterMatcher<this>

report

report: IRouterMatcher<this>

resource

resource: any

router

router: string

routes

routes: any

The app.routes object houses all of the routes defined mapped by the associated HTTP verb. This object may be used for introspection capabilities, for example Express uses this internally not only for routing but to provide default OPTIONS behaviour unless app.options() is used. Your application or framework may also remove routes by simply by removing them from this object.

search

search: IRouterMatcher<this>

settings

settings: any

stack

stack: any[]

Stack of configured routes

subscribe

subscribe: IRouterMatcher<this>

trace

trace: IRouterMatcher<this>

unlock

unlock: IRouterMatcher<this>

unsubscribe

unsubscribe: IRouterMatcher<this>

use

Static defaultMaxListeners

defaultMaxListeners: number

Methods

addListener

  • addListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

defaultConfiguration

  • defaultConfiguration(): void
  • Initialize application configuration.

    Returns void

disable

  • Disable setting.

    Parameters

    • setting: string

    Returns Application

disabled

  • disabled(setting: string): boolean
  • Check if setting is disabled.

    app.disabled('foo') // => true

    app.enable('foo') app.disabled('foo') // => false

    Parameters

    • setting: string

    Returns boolean

emit

  • emit(event: string | symbol, ...args: any[]): boolean
  • Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

enable

  • Enable setting.

    Parameters

    • setting: string

    Returns Application

enabled

  • enabled(setting: string): boolean
  • Check if setting is enabled (truthy).

    app.enabled('foo') // => false

    app.enable('foo') app.enabled('foo') // => true

    Parameters

    • setting: string

    Returns boolean

engine

  • Register the given template engine callback fn as ext.

    By default will require() the engine based on the file extension. For example if you try to render a "foo.jade" file Express will invoke the following internally:

    app.engine('jade', require('jade').__express);

    For engines that do not provide .__express out of the box, or if you wish to "map" a different extension to the template engine you may use this method. For example mapping the EJS template engine to ".html" files:

    app.engine('html', require('ejs').renderFile);

    In this case EJS provides a .renderFile() method with the same signature that Express expects: (path, options, callback), though note that it aliases this method as ejs.__express internally so if you're using ".ejs" extensions you dont need to do anything.

    Some template engines do not follow this convention, the Consolidate.js library was created to map all of node's popular template engines to follow this convention, thus allowing them to work seamlessly within Express.

    Parameters

    • ext: string
    • fn: function
        • (path: string, options: object, callback: function): void
        • Parameters

          • path: string
          • options: object
          • callback: function
              • (e: any, rendered: string): void
              • Parameters

                • e: any
                • rendered: string

                Returns void

          Returns void

    Returns Application

eventNames

  • eventNames(): Array<string | symbol>

getMaxListeners

  • getMaxListeners(): number

init

  • init(): void
  • Initialize the server.

    • setup default configuration
    • setup default middleware
    • setup route reflection methods

    Returns void

listen

  • listen(port: number, hostname: string, backlog: number, callback?: undefined | function): Server
  • listen(port: number, hostname: string, callback?: undefined | function): Server
  • listen(port: number, callback?: undefined | function): Server
  • listen(callback?: undefined | function): Server
  • listen(path: string, callback?: undefined | function): Server
  • listen(handle: any, listeningListener?: undefined | function): Server
  • Listen for connections.

    A node http.Server is returned, with this application (which is a Function) as its callback. If you wish to create both an HTTP and HTTPS server you may do so with the "http" and "https" modules as shown here:

    var http = require('http') , https = require('https') , express = require('express') , app = express();

    http.createServer(app).listen(80); https.createServer({ ... }, app).listen(443);

    Parameters

    • port: number
    • hostname: string
    • backlog: number
    • Optional callback: undefined | function

    Returns Server

  • Parameters

    • port: number
    • hostname: string
    • Optional callback: undefined | function

    Returns Server

  • Parameters

    • port: number
    • Optional callback: undefined | function

    Returns Server

  • Parameters

    • Optional callback: undefined | function

    Returns Server

  • Parameters

    • path: string
    • Optional callback: undefined | function

    Returns Server

  • Parameters

    • handle: any
    • Optional listeningListener: undefined | function

    Returns Server

listenerCount

  • listenerCount(type: string | symbol): number

listeners

  • listeners(event: string | symbol): Function[]

off

  • off(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

once

  • once(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

param

  • param(name: string | string[], handler: RequestParamHandler): this
  • param(callback: function): this
  • Parameters

    Returns this

  • Alternatively, you can pass only a callback, in which case you have the opportunity to alter the app.param()

    deprecated

    since version 4.11

    Parameters

    Returns this

path

  • path(): string
  • Return the app's absolute pathname based on the parent(s) that have mounted it.

    For example if the application was mounted as "/admin", which itself was mounted as "/blog" then the return value would be "/blog/admin".

    Returns string

prependListener

  • prependListener(event: string | symbol, listener: function): this

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: function): this

rawListeners

  • rawListeners(event: string | symbol): Function[]

removeAllListeners

  • removeAllListeners(event?: string | symbol): this

removeListener

  • removeListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

render

  • render(name: string, options?: undefined | object, callback?: undefined | function): void
  • render(name: string, callback: function): void
  • Render the given view name name with options and a callback accepting an error and the rendered template string.

    Example:

    app.render('email', { name: 'Tobi' }, function(err, html){ // ... })

    Parameters

    • name: string
    • Optional options: undefined | object
    • Optional callback: undefined | function

    Returns void

  • Parameters

    • name: string
    • callback: function
        • (err: Error, html: string): void
        • Parameters

          • err: Error
          • html: string

          Returns void

    Returns void

route

  • Parameters

    Returns IRoute

set

  • Assign setting to val, or return setting's value.

    app.set('foo', 'bar'); app.get('foo'); // => "bar" app.set('foo', ['bar', 'baz']); app.get('foo'); // => ["bar", "baz"]

    Mounted servers inherit their parent server's settings.

    Parameters

    • setting: string
    • val: any

    Returns Application

setMaxListeners

  • setMaxListeners(n: number): this

Static listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number
  • deprecated

    since v4.0.0

    Parameters

    Returns number

Generated using TypeDoc