-
-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathapi.ts
More file actions
26 lines (21 loc) · 731 Bytes
/
api.ts
File metadata and controls
26 lines (21 loc) · 731 Bytes
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
import express from "express";
import morgan from "morgan";
import { errorHandler } from "./api/errorHandler";
import { router } from "./api/router";
import { userAgentMiddleware } from "./api/userAgent";
const { version } = require("../package.json");
const port = parseInt(process.env.PORT!) || 7070;
const app = express();
app.use(morgan("common"));
app.use(userAgentMiddleware);
app.use("/", router);
app.use("/", errorHandler);
app.use("*", (_req, res) =>
res.send(
`Welcome to COVID-19 Tracker CLI v${version} by Waren Gonzaga with Wareneutron Developers\n
Please visit: https://warengonza.ga/covid19-tracker-cli\n`
)
);
app.listen(port, () => {
console.log(`Express listening on port ${port}`);
});