-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.js
More file actions
23 lines (18 loc) · 844 Bytes
/
index.js
File metadata and controls
23 lines (18 loc) · 844 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import http from "http";
import { createGatewayRemote } from "gateway/remote.js";
import { createGatewayService } from "gateway/service.js";
import logger from "shared/logger.js";
import { createSchemaReadyServiceApp } from "../shared/service-app.js";
import { createCmsRouter } from "./http.js";
import { createCmsService } from "./service.js";
const { PORT = 3002, GATEWAY_URL } = process.env;
const gateway = GATEWAY_URL
? createGatewayRemote({ baseUrl: GATEWAY_URL })
: createGatewayService();
const application = createCmsService({ gateway, source: "internal-http" });
const app = createSchemaReadyServiceApp({
router: createCmsRouter({ application }),
mountPath: "/api/v1",
readinessFailureMessage: "CMS schema readiness failed",
});
http.createServer(app).listen(PORT, () => logger.info(`CMS listening on port ${PORT}`));