-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
26 lines (24 loc) · 956 Bytes
/
server.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
import express from "express";
import favicon from "serve-favicon";
import path from "path";
import bodyParser from "body-parser";
import cookieParser from "cookie-parser";
import fileUpload from "express-fileupload";
import { engine } from "express-handlebars";
import { router } from "./routes.js";
import { handlebarsHelpers } from "./helpers/handlebars-helper.js";
import dotenv from 'dotenv';
dotenv.config();
const app = express();
app.use(cookieParser());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(express.static("public"));
app.use(favicon(path.join("public", "images", "favicon.ico")));
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 || 4000, function () {
console.log(`WeatherTop started on http://localhost:${listener.address().port}`);
});