Initial Node.js TypeScript service
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import express from "express";
|
||||
|
||||
const app = express();
|
||||
const port = Number(process.env.PORT || 3000);
|
||||
const rootPath = process.env.ROOT_PATH || "";
|
||||
|
||||
app.get("/", (_req, res) => {
|
||||
res.json({
|
||||
name: "Polstrin SAP BO1",
|
||||
service: "polstrin-sap",
|
||||
status: "ok"
|
||||
});
|
||||
});
|
||||
|
||||
app.get("/health", (_req, res) => {
|
||||
res.json({ status: "ok" });
|
||||
});
|
||||
|
||||
if (rootPath) {
|
||||
app.get(rootPath, (_req, res) => {
|
||||
res.json({
|
||||
name: "Polstrin SAP BO1",
|
||||
service: "polstrin-sap",
|
||||
status: "ok"
|
||||
});
|
||||
});
|
||||
|
||||
app.get(rootPath + "/health", (_req, res) => {
|
||||
res.json({ status: "ok" });
|
||||
});
|
||||
}
|
||||
|
||||
app.listen(port, "0.0.0.0", () => {
|
||||
console.log("polstrin-sap listening on port " + port);
|
||||
});
|
||||
Reference in New Issue
Block a user