-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
41 lines (30 loc) · 928 Bytes
/
main.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
require('dotenv').config()
const database = require('./database')
database.connect()
const bodyParser = require("body-parser")
const express = require('express')
const cors = require('cors');
const path = require('path')
const app = express()
const port = process.env.PORT || 3000
app.use(bodyParser.urlencoded({
extended: true
}));
app.use(bodyParser.json());
app.use(cors())
const register = require('./routes/register')
app.use("/register", register)
const login = require('./routes/login')
app.use("/login", login)
const stratRoute = require('./routes/strat')
app.use("/strat", stratRoute)
const silverRoute = require('./routes/silver')
app.use("/silver", silverRoute)
app.use(express.static('public'));
app.route('/*')
.get(function(req, res) {
res.sendFile(path.join(__dirname + '/public/index.html'));
});
app.listen(port, () => {
console.log(`Example app listening on port ${port}`)
})