feat: add sequelize with postgres UTC timestamp endpoint

This commit is contained in:
Noah Holt 2026-08-11 00:15:40 -05:00
parent 1365bd7644
commit 8237c6cd2a
8 changed files with 450 additions and 7 deletions

View file

@ -1,6 +1,7 @@
import express from "express";
import { hostname } from "node:os";
import { greeting } from "./greeting.js";
import { getUtcTimestamp } from "./services/database.js";
const app = express();
const port = Number(process.env.PORT ?? 3000);
@ -20,4 +21,13 @@ app.get("/", (_req, res) => {
});
});
app.get("/utc-time", async (_req, res) => {
const utcTime = await getUtcTimestamp();
if (!utcTime) {
res.status(503).json({ error: "Database not configured or unavailable" });
return;
}
res.json({ utc_time: utcTime });
});
export { app, port };