forked from OfficeDev/Microsoft-Teams-Samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
38 lines (30 loc) · 1.01 KB
/
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
38
const express = require('express');
const bodyparser = require('body-parser');
const path = require('path');
const app = express();
const server = require('http').createServer(app);
const io = require('socket.io')(server,{cors:{origin:"*"}});
app.use(express.static(__dirname + '/static'));
app.engine('html', require('ejs').renderFile);
app.set('view engine', 'ejs');
app.set('views', __dirname);
const ENV_FILE = path.join(__dirname, '.env');
require('dotenv').config({ path: ENV_FILE });
app.get('/configure', function (req, res) {
res.render('./views/configure');
});
app.get('/index', function (req, res) {
res.render('./views/index');
});
app.get('/appInMeeting', function (req, res) {
res.render('./views/appInMeeting');
});
app.use("/Images", express.static(path.resolve(__dirname, './Images')));
io.on("connection", (socket) => {
socket.on("message", (message, status) => {
io.emit("message", message, status)
})
});
server.listen(3978, function () {
console.log('app listening on port 3978!');
});