-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
executable file
·45 lines (36 loc) · 1.2 KB
/
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
36
37
38
39
40
41
42
43
44
45
const express = require('express')
const app = express()
const path = require('path')
const cors = require('cors')
app.use(cors())
/*Port the server will run on*/
const port = 8888
/*Use bodyParser to parse form data*/
const bodyParser = require('body-parser')
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }))
/*Serve static assets from the public folder*/
global.__basedir = __dirname;
app.use(express.static(path.join(__dirname, 'public')))
/*Import all of the route modules*/
const portal = require('./routes/portal')
const api = require('./routes/api')
const playlists = require('./routes/playlists')
const numeracy = require('./routes/numeracy')
const literacy = require('./routes/literacy')
const grade7 = require('./routes/grade7')
const surveys = require('./routes/surveys')
app.use('/', portal)
app.use('/api', api)
app.use('/playlists', playlists)
app.use('/numeracy', numeracy)
/*app.use('/literacy', literacy)*/
app.use('/grade7', grade7)
app.use('/surveys', surveys)
/*Results dashboard page*/
app.get('/coach', (req, res) => {
res.sendFile(__dirname + '/dashboard/index.html')
})
app.listen(port, '0.0.0.0', () => {
console.log('Server running on port ' + port)
})