File size: 726 Bytes
d531093
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import express from 'express';
import cookieParser from 'cookie-parser';
import { jsonParserErrorHandler } from './middleware/json-errors.js';
import { requireJsonContentType } from './middleware/require-json-content-type.js';
/** Production transport assembly, shared by the actual startup and integration tests. */
export function createHttpApplication(
  options: {
    beforeParsing?: (app: express.Express) => void;
    routes?: (app: express.Express) => void;
  } = {}
) {
  const app = express();
  options.beforeParsing?.(app);
  app.use(express.json({ limit: '50mb' }));
  app.use(cookieParser());
  app.use(jsonParserErrorHandler);
  app.use('/api', requireJsonContentType);
  options.routes?.(app);
  return app;
}