acebase-server/dist/esm/shared/http.js
2022-04-12 15:41:13 +02:00

16 lines
No EOL
615 B
JavaScript

import * as express from 'express';
const createExpress = express.default ?? express; // ESM and CJS compatible approach
/**
* Creates an app that handles http requests, adds json body parsing.
* @param settings
* @returns
*/
export const createApp = (settings) => {
const app = createExpress();
// When behind a trusted proxy server, req.ip and req.hostname will be set the right way
app.set('trust proxy', settings.trustProxy);
// Parse json request bodies
app.use(express.json({ limit: settings.maxPayloadSize })); // , extended: true ?
return app;
};
//# sourceMappingURL=http.js.map