init.js 615 Bytes
Newer Older
KangMin An's avatar
KangMin An committed
1
2
import app from "./app";
import dotenv from "dotenv";
3
import "./schedules"; // 매일 자정 데이터 처리
4
import db from "./db/index";
5
import setLocTables from "./db/locationSetting";
6

KangMin An's avatar
KangMin An committed
7
8
9
10
11
dotenv.config();

const PORT = process.env.PORT || 4500;

const handleListening = () => {
12
  console.log(`✅ Listening on : http://localhost:${PORT}`);
KangMin An's avatar
KangMin An committed
13
14
};

15
16
// DB 연결
db.sequelize
17
  .sync({ force: true })
18
  .then(() => {
19
    console.log(db.msg.connection_success);
20
  })
21
  .then(() => setLocTables())
22
  .catch((err) => {
23
    console.log(db.msg.connection_err);
24
25
26
    console.log(err);
  });

KangMin An's avatar
KangMin An committed
27
app.listen(PORT, handleListening);