Add started date for instance that started

This commit is contained in:
Sambo Chea 2021-09-13 17:57:27 +07:00
parent e3bb729619
commit 87db149df0

View File

@ -4,12 +4,13 @@ import { SERVER_PORT } from "./app.config"
// get current host id
const hostId = `${require("os").hostname()}#${process.pid}`
const startedAt = new Date()
const app = Express()
const httpServer = createServer(app)
console.log(
`Application server running on: ${hostId} at port: ${SERVER_PORT} and started at: ${Date()}`
`Application server running on: ${hostId} at port: ${SERVER_PORT} and started at: ${startedAt}`
)
httpServer.listen(SERVER_PORT)
@ -17,6 +18,7 @@ httpServer.listen(SERVER_PORT)
app.get("/", (req, res) => {
res.type("json")
res.send({
startedAt,
message: `Instance id: ${hostId}`,
status: "OK",
})