-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.js
29 lines (25 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
const express = require("express");
const bodyParser = require("body-parser");
const cookieParser = require("cookie-parser");
const cors = require("cors");
const nocache = require('nocache');
const app = express();
const corsOptions = {
origin: "*",
allowedHeaders: "*",
optionsSuccessStatus: 200,
method: "GET ,HEAD ,PUT ,PATCH, POST, DELETE, OPTIONS",
};
app.use(cors(corsOptions));
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.use(cookieParser());
app.use(nocache());
app.disable('view cache');
app.use("/uploads", express.static("./app/uploads"));
app.get("/", (req, res) => {
res.json({ message: "Selamat datang di omorphia API." });
});
const port = 3001;
require("./app/routes/all.routes")(app);
app.listen(port, () => console.log(`Server ini berjalan dalam port ` + [port]));