-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
25 lines (20 loc) · 795 Bytes
/
server.js
File metadata and controls
25 lines (20 loc) · 795 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
import express from "express";
import bodyParser from "body-parser";
import cookieParser from "cookie-parser";
import fileUpload from "express-fileupload";
import "dotenv/config";
import { engine } from "express-handlebars";
import { router } from "./routes.js";
import { handlebarsHelpers } from "./hb-helpers.js";
const app = express();
app.use(cookieParser());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(express.static("public"));
app.use(fileUpload());
app.engine(".hbs", engine({ extname: ".hbs", helpers: handlebarsHelpers }));
app.set("view engine", ".hbs");
app.set("views", "./views");
app.use("/", router);
const listener = app.listen(process.env.PORT || 3000, function () {
console.log(`WeatherTop started on http://localhost:${listener.address().port}`);
});