-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
43 lines (35 loc) · 1.19 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
const path = require('path');
const express = require('express');
const bodyParser = require('body-parser');
require("dotenv").config();
const app = express();
const {v4 : uuidv4} = require('uuid')
const server = require("http").Server(app);
const cookies = require('cookies')
const { connect } = require('mongoose');
connect(process.env.mongoPath, {
useNewUrlParser: true,
useUnifiedTopology: true,
}).then(() => {
console.log('Database connected');
});
const adminData = require('./routes/admin');
const shopRoutes = require('./routes/shop');
const discordRoutes = require('./routes/discord');
const invRoutes = require('./routes/inventory')
const twitterRoutes = require('./routes/twitter')
const profileRoutes = require('./routes/profile')
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({extended: false}));
app.use(express.static(path.join(__dirname, 'public')));
app.set("view engine", "ejs");
app.use(cookies.express(["some", "random", "keys"]))
app.use(adminData.router);
app.use(shopRoutes.router);
app.use(discordRoutes);
app.use(invRoutes);
app.use(twitterRoutes);
app.use(profileRoutes);
server.listen(process.env.PORT || 3000, () => {
console.log('Running on localhost 3000')
});