forked from OfficeDev/Microsoft-Teams-Samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
38 lines (28 loc) · 1014 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 bodyparser = require('body-parser');
const env = require('dotenv')
const path = require('path');
const auth = require('./auth');
const indexRouter = require('./routes/index');
require('isomorphic-fetch');
const app = express();
app.use(express.static(__dirname + '/Styles'));
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.use('/',indexRouter);
app.get('/configure', function(req, res) {
res.render('./views/configure');
});
app.get('/rscdemo', function(req, res) {
var tenantId=req.url.split('=')[1];
auth.getAccessToken(tenantId).then(async function (token) {
console.log("token from js file : "+ token);
res.render('./views/rscdemo',{token:JSON.stringify(token)});
});
});
app.listen(3978 ||3978, function () {
console.log('app listening on port 3333!');
});