-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathserver.js
37 lines (23 loc) · 852 Bytes
/
server.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
const express = require('express');
const mongoose = require('./mongoose')();
const bodyParser = require('body-parser');
const jwt = require('jsonwebtoken');
const secret = "totallysecret";
const app = express();
const server = require('http').createServer(app);
const io = require('socket.io').listen(server);
const UM = require('./userManagement/user.js');
app.set('view engine', 'ejs');
app.use(bodyParser.urlencoded({extended:false}));
app.use(bodyParser.json());
app.get('/', UM.entryPage);
app.get('/register/', UM.getRegister);
app.post('/register/', UM.register);
app.get('/verify/', UM.verify);
app.get('/users/', UM.displayList);
app.get('/login/', UM.getLogin);
app.post('/login/', UM.login);
app.post('/logout/', UM.logOut);
io.on('connection', UM.webSocketTest);
app.post('/messages/send/', UM.sendMsg);
server.listen(5000);