-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
31 lines (26 loc) · 1.04 KB
/
index.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
const express = require('express');
require('dotenv').config();
// const sequelize = require('./db');
// const authRoute = require('./routes/authRouter');
// const Models = require('./models/Models');
// CONSTANTS---------------------------------------
// const PORT = process.env.PORT;
const app = express();
app.use(express.json());
// app.use('/auth', authRoute);
// CONSTANTS---------------------------------------
// START APP----------------------------------------
const start = async () => {
try {
// await sequelize.authenticate(); //подключение к БД
// await sequelize.sync(); //сверяем БД с теми моделями что мы описали
await app.listen(90, () => console.log(`SERVER START ON PORT - 90`)); //запуск сервера
} catch (e) {
console.log(`ERROR - ${e}`) //отлавливаем ошибку при подключении
}
}
start();
// START APP----------------------------------------
app.get('/', (req, res) => {
res.json('SERVER START');
})