INNER CODE UNIT · TypeScript
init
getwud/wud · app/api/index.ts:22
export async function init() {
// Start API if enabled
if (configuration.enabled) {
log.debug(
`API/UI enabled => Start Http listener on port ${configuration.port}`,
);
// Init Express app
const app = express();
// Trust proxy (helpful to resolve public facing hostname & protocol)
app.set('trust proxy', true);
// Replace undefined values by null to prevent them from being removed from json responses
app.set('json replacer', (key, value) =>
value === undefined ? null : value,
);