MCPcopy
hub / github.com/fosrl/pangolin / createInternalServer

Function createInternalServer

server/internalServer.ts:16–44  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14const internalPort = config.getRawConfig().server.internal_port;
15
16export function createInternalServer() {
17 const internalServer = express();
18
19 const trustProxy = config.getRawConfig().server.trust_proxy;
20 if (trustProxy) {
21 internalServer.set("trust proxy", trustProxy);
22 }
23
24 internalServer.use(helmet());
25 internalServer.use(cors());
26 internalServer.use(stripDuplicateSesions);
27 internalServer.use(cookieParser());
28 internalServer.use(express.json());
29
30 const prefix = `/api/v1`;
31 internalServer.use(prefix, internalRouter);
32
33 internalServer.use(notFoundMiddleware);
34 internalServer.use(errorHandlerMiddleware);
35
36 internalServer.listen(internalPort, (err?: any) => {
37 if (err) throw err;
38 logger.info(
39 `Internal API server is running on http://localhost:${internalPort}`
40 );
41 });
42
43 return internalServer;
44}

Callers 1

startServersFunction · 0.90

Calls 2

getRawConfigMethod · 0.80
setMethod · 0.45

Tested by

no test coverage detected