Skip to content
This repository has been archived by the owner on Nov 15, 2017. It is now read-only.

Commit

Permalink
Adds hooks to createExpressServer
Browse files Browse the repository at this point in the history
Allows to plug in own middleware to server if e.g. the body must not be parsed before using the middleware
  • Loading branch information
fastner committed Mar 24, 2017
1 parent 488cddf commit a00e3ff
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/api/server/createExpressServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pretty.skipNodeFiles()
// this will skip all the trace lines about express` core and sub-modules
pretty.skipPackage("express")

export default function createExpressServer(config)
export default function createExpressServer(config, hooks)
{
// Create our express based server.
const server = express()
Expand Down Expand Up @@ -137,6 +137,9 @@ export default function createExpressServer(config)
// @see https://helmetjs.github.io/docs/dont-sniff-mimetype/
server.use(helmet.noSniff())

if (hook.onSecuredServerCreated)
hook.onSecuredServerCreated(server)

// Parse cookies via standard express tooling
server.use(cookieParser())

Expand Down

0 comments on commit a00e3ff

Please sign in to comment.