Add started date for instance that started
This commit is contained in:
parent
e3bb729619
commit
87db149df0
@ -4,12 +4,13 @@ import { SERVER_PORT } from "./app.config"
|
|||||||
|
|
||||||
// get current host id
|
// get current host id
|
||||||
const hostId = `${require("os").hostname()}#${process.pid}`
|
const hostId = `${require("os").hostname()}#${process.pid}`
|
||||||
|
const startedAt = new Date()
|
||||||
|
|
||||||
const app = Express()
|
const app = Express()
|
||||||
const httpServer = createServer(app)
|
const httpServer = createServer(app)
|
||||||
|
|
||||||
console.log(
|
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)
|
httpServer.listen(SERVER_PORT)
|
||||||
|
|
||||||
@ -17,6 +18,7 @@ httpServer.listen(SERVER_PORT)
|
|||||||
app.get("/", (req, res) => {
|
app.get("/", (req, res) => {
|
||||||
res.type("json")
|
res.type("json")
|
||||||
res.send({
|
res.send({
|
||||||
|
startedAt,
|
||||||
message: `Instance id: ${hostId}`,
|
message: `Instance id: ${hostId}`,
|
||||||
status: "OK",
|
status: "OK",
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user