-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
35 lines (25 loc) · 943 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
29
30
31
32
33
34
35
require('dotenv').config()
const express = require('express')
const bodyParser = require('body-parser')
const cors = require('cors')
const massive = require('massive')
const path = require('path')
const { SERVER_PORT, DB_URI } = process.env
const app = express()
massive(DB_URI).then(instance => app.set('db', instance))
app.use(bodyParser.json())
app.use(cors())
//LOGIN
app.use('/api/login', require('./routes/login'))
//REGISTER
app.use('/api/register', require('./routes/register'))
//Project endpoints
// app.use('/api/project', require('./routes/project'))
//Task endpoints
// app.use('/api/task', require('./routes/task'))
// app.use('/api/completed', require('./routes/completedTask'))
app.use(express.static(`${__dirname}/public`))
app.all('*', function(req, res, next) {
res.sendFile(path.resolve(`${__dirname}/public/index.html`))
})
app.listen(SERVER_PORT, () => console.log(`Server listening on port ${SERVER_PORT}`))