-
Notifications
You must be signed in to change notification settings - Fork 4
/
app.js
33 lines (24 loc) · 837 Bytes
/
app.js
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
import { dirname } from "path";
import { fileURLToPath } from "url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
import express from "express";
import { engine } from "express-handlebars";
import session from "express-session";
import bodyParser from "body-parser";
import indexRoute from "./routes/index.js";
const app = express();
app.engine("handlebars", engine());
app.set("views", __dirname + "/views");
app.set("view engine", "handlebars");
app.use(bodyParser.json());
app.use(function (req, res, next) {
res.setHeader("Access-Control-Allow-Origin", "*");
next();
});
console.log("loading app...");
app.use("/", indexRoute);
app.use("/images", express.static(__dirname + "/temp/"));
app.use(express.static("public"));
app.use(express.static("views"));
export default app;