-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
45 lines (38 loc) · 1.03 KB
/
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
34
35
36
37
38
39
40
41
42
43
44
45
const express = require("express");
const cors = require("cors");
const morgan = require("morgan");
const { sequelize } = require("./models");
const app = express();
const port = 3000;
// const whitelist = [
// "http://somfist.shop",
// "http://somfist.shop.s3-website.ap-northeast-2.amazonaws.com",
// ];
// const corsOptions = {
// origin: function (origin, callback) {
// if (whitelist.indexOf(origin) !== -1) {
// callback(null, true);
// } else {
// console.log(origin);
// callback(new Error("Not Allowed Origin!"));
// }
// },
// };
app.use(morgan("dev"));
//app.use(cors(corsOptions));
//app.use(cors());
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
// sequelize
// .sync({ force: true })
// .then(() => {
// console.log("db connect seccess");
// })
// .catch((err) => {
// console.error(err);
// });
const indexRouter = require("./layers/routers");
app.use("/api", indexRouter);
app.listen(port, () => {
console.log(port, "진행해주세요");
});