forked from prady8339/node-bus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
43 lines (35 loc) · 1.42 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
require('dotenv').config();
const express = require("express");
const bodyParser = require("body-parser");
const passport = require("passport");
const port = process.env.PORT || 3000;
const hostname = process.env.HOSTNAME || 'localhost';
const app = express();
app.set('view engine', 'ejs');
app.use(bodyParser.urlencoded({ extended: true }));
app.use(express.static('public'));
const connection = require('./db');
connection();
const User = require('./schema/user');
const passportme = require('./schema/passport');
(async () => {
await passportme(app, User, passport, hostname, port);
const Post = require('./schema/post');
const imgModel = require('./schema/image');
const chatModel = require('./schema/chat');
require('./routes/chat')(app, User, chatModel);
require('./routes/login')(app, passport);
require('./routes/secrets')(app, Post);
require('./routes/submit')(app, User);
require('./routes/register')(app, User, passport);
require('./routes/home')(app, Post, User);
require('./routes/compose')(app, Post, User);
require('./routes/postPage')(app, Post, User);
require('./routes/search')(app, Post, User);
require('./routes/profile')(app, Post, User);
require('./routes/settings')(app, imgModel, __dirname);
// require('./routes/websocket/server')(app);
app.listen(process.env.PORT || port, () => {
console.log(`The application started successfully on port http://${hostname}:${port}`);
});
})();