Application
Expressify’s app factory. This module exports a function you can use to create and configure an express app. With some often used settings and middlewares.
Options
body
: Object to configure thebody-parser
middleware. Subkeys map to methods on body-parser, passingtrue
will call the method without options while setting an object will pass that object to body parser. Defaults to{ json: true }
to enable JSON formatted body parsing.compression
: Enablecompression
middleware. Usetrue
to enable or an object to customize options. Defaults totrue
.cors
: Enable Expressify’s CORS middleware. Usetrue
to enable or an object to customize its options. Defaults totrue
.express
: Use this to pass in a customexpress
module. Defaults to the express module defined in Expressify’s dependencies.trustProxy
: Set express’trust proxy
setting. Defaults totrue
.
Example
const expressify = require('@ambassify/expressify');
// Default options
const app = expressify.createApp();
// URL encoded body instead of JSON
const app = expressify.createApp({
body: {
urlencoded: true
}
});