-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
36 lines (29 loc) · 826 Bytes
/
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
34
35
36
/** @format */
var express = require("express");
var bodyParser = require("body-parser");
const path = require("path");
// Create new instance of the express server
var app = express();
app.use(bodyParser.json());
// Create link to Angular build directory
// The `ng build` command will save the result
// under the `dist` folder.
var distDir = __dirname + "/dist/Minion/";
app.use(express.static(distDir));
// Init the server
var server = app.listen(process.env.PORT || 8080, function () {
var port = server.address().port;
console.log("App now running on port", port);
});
/**
* GET /_health
*/
app.get("/api/_health", function (req, res) {
res.status(200).json({ status: "i am ok!" });
});
/**
* GET /*
*/
app.get("/*", function (req, res) {
res.sendFile(path.join(__dirname, "dist/Minion/index.html"));
});