-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathserver.js
More file actions
42 lines (39 loc) · 1.08 KB
/
Copy pathserver.js
File metadata and controls
42 lines (39 loc) · 1.08 KB
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
37
38
39
40
41
42
const express = require("express");
const exphbs = require("express-handlebars");
const routers = require("./routers/index");
const cookieParser = require("cookie-parser");
const port = require("./settings").PORT;
const hosturl = require("./settings").HOST_URL;
const app = express();
app.use(express.json())
.use(
express.urlencoded({
extended: true,
})
)
.use(cookieParser())
.use(express.static("./public"))
.engine(
".hbs",
exphbs({
defaultLayout: false,
extname: ".hbs",
})
)
.set("view engine", ".hbs")
.use("/", routers.app)
.use("/api", routers.api)
.use((req, res, next) => {
res.status(404).send("Not found !");
next();
})
.listen(port, (_) => {
console.log(
"\x1b[36m%s\x1b[0m",
"iPara projesi şu url de çalışıyor : " + `${hosturl}`
);
console.log(
"\x1b[32m%s\x1b[0m",
"- Server'i durdurmak icin terminali kapatin ya da terminalde CTRL-C tuşlayın -"
);
});