-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
38 lines (31 loc) · 922 Bytes
/
app.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
34
35
36
37
38
var path = require("path");
var express = require("express");
var app = express();
var helmet = require("helmet");
var winston = require("winston");
const port = 8080;
// log everything to stdout for use in kubernetes
const logger = winston.createLogger({
transports: [
new winston.transports.Console({
handleExceptions: true
})
],
exitOnError: false
});
console.log("NODE ENV IS:", process.env.NODE_ENV);
app.use(helmet());
app.use(express.static(path.join(__dirname, "dist")));
app.set("views", __dirname + "/dist");
app.engine("html", require("ejs").renderFile);
app.set("view engine", "html");
// k8s liveness and readyness probe entrypoint
app.get('/alive_and_ready', function (req, res) {
res.json({ status: 'alive and ready' })
});
app.get("/*", function(req, res) {
res.render("index");
});
app.listen(port, function() {
logger.info(`dds-api-keys listening on port ${port}!`);
});