-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
28 lines (22 loc) · 836 Bytes
/
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
const amqp = require('amqplib');
const bluebird = require('bluebird');
const dotenv = require('dotenv');
const passport = require('passport');
const pgp = require('pg-promise');
const dbConfig = require('./server/database');
const expressConfig = require('./server/express');
const passportConfig = require('./server/passport');
const rabbitConfig = require('./server/rabbit');
const consumerConfig = require('./server/consumers');
(async () => {
dotenv.config();
const port = process.env.SERVER_PORT;
const db = dbConfig(bluebird, pgp);
const rabbit = await rabbitConfig(amqp);
passportConfig(passport, db);
const app = expressConfig(db, passport);
await consumerConfig(rabbit.channel);
app.listen(port, console.log(`Listening on port ${port}`));
})().catch((err) => {
console.error(err);
});