@apolitical/server
Version:
Node.js module to encapsulate Apolitical's express server setup
29 lines (26 loc) • 628 B
JavaScript
;
module.exports = ({
authenticationMiddleware,
authorisationMiddleware,
expressService: { startup, shutdown },
healthService: { registerShutdown },
jwtService,
serverError,
requestHelper,
secretsService,
}) => {
// Register shutdown to clean up any resources used by the express app
registerShutdown(shutdown);
return {
start: startup,
stop: shutdown,
jwt: jwtService,
errors: serverError,
middlewares: {
authentication: authenticationMiddleware,
authorisation: authorisationMiddleware,
},
request: requestHelper,
secrets: secretsService,
};
};