-
Notifications
You must be signed in to change notification settings - Fork 58
/
Server.js
33 lines (23 loc) · 1.07 KB
/
Server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env node
(function () {
"use strict";
const WEBSERVER_DEFAULT_PORT = 8120;
let port = process.env.PORT || WEBSERVER_DEFAULT_PORT;
let secretManagement = require("./SecretManagement");
secretManagement.tryLoadSecrets();
let express = require("express");
let app = express();
// We disable etag as it causes API calls to be cached even with Cache-Control: no-cache.
app.disable("etag");
// At /, we serve the website folder as static resources.
app.use(express.static(__dirname + '/Website'));
// At /api/catalog is the catalog API that provides data for the frontend.
let catalogApi = require("./CatalogApi");
app.use("/api/catalog", catalogApi.createRouter());
// At /api/authorization is the Entitlement Service.
let entitlementService = require("./EntitlementService");
app.use("/api/authorization", entitlementService.createRouter());
app.listen(port);
console.log("The website is now available at http://localhost:" + port);
console.log("Press Control+C to shut down the application.");
})();