-
Notifications
You must be signed in to change notification settings - Fork 1
/
express.js
29 lines (26 loc) · 988 Bytes
/
express.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
const express = require('express');
const bodyParser = require('body-parser');
const path = require('path');
const history = require('connect-history-api-fallback');
const app = express();
const port = 3000;
const staticFileMiddleware = express.static(path.join(__dirname + '/public'));
const serverFunctions = require('./src/serverFunctions');
app.use(staticFileMiddleware);
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.use(history({
disableDotRule: true
}));
app.use(staticFileMiddleware);
app.get('/', function(req, res) {
res.render(path.join(__dirname + '/public/index.html'));
});
app.post('/Image', serverFunctions.image);
app.post('/setRoles', serverFunctions.setRoles);
app.post('/setNewUserRoles', serverFunctions.setNewUserRoles);
app.post('/getAllUsers', serverFunctions.getAllUsers);
app.post('/addStudy', serverFunctions.addStudy);
app.listen(port, () => {
console.log(`BrainSwipes listening at http://localhost:${port}`)
})