-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
26 lines (22 loc) · 683 Bytes
/
app.js
File metadata and controls
26 lines (22 loc) · 683 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 { fileURLToPath } from "url";
import { join } from "path";
import cors from "cors";
import express from "express";
import morgan from "morgan";
import path from "path";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const app = express();
app.use(cors());
app.use(morgan("dev"));
app.use(express.static(join(__dirname, "dist")));
app.use((_, res) => {
res.sendFile(join(__dirname, "dist", "index.html"));
});
const portNo = process.env.PORT_NO || 3000;
const svcNm = process.env.SVC_NM || "custom";
app.listen(portNo, () =>
console.log(
`${svcNm} ui preview on following\n➜ Local: http://localhost:${portNo}`
)
);