forked from Software-Crafters-Manchester/flownami
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.ts
More file actions
36 lines (28 loc) · 789 Bytes
/
main.ts
File metadata and controls
36 lines (28 loc) · 789 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
27
28
29
30
31
32
33
34
35
36
// @ts-types="npm:@types/express"
import express from "npm:express";
import tasksRouter from "./tasks/handler.ts";
import boardRouter from "./board/handler.ts";
export const app = express();
app.set("view engine", "ejs");
app.use(express.static("static"));
app.use(
"/scripts",
express.static("scripts", {
setHeaders: function (res, _path, _stat) {
res.type("application/javascript");
},
}),
);
app.use(express.urlencoded({ extended: true }));
app.use(express.json());
app.get("/", function (_req, res) {
res.render("index");
});
app.use("/tasks", tasksRouter);
app.use("/board", boardRouter);
if (import.meta.main) {
const port = Deno.env.get("PORT") || 8080;
app.listen(port);
console.log(`Server is listening on port ${port}`);
}
export default app;