forked from OfficeDev/Microsoft-Teams-Samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
31 lines (25 loc) · 904 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
const express = require('express');
const bodyparser = require('body-parser');
const env = require('dotenv')
const path = require('path');
const auth = require('./auth');
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.get('/configure', function (req, res) {
res.render('./views/configure');
});
app.get('/installedAppsList', 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/installedAppsList', { token: JSON.stringify(token) });
});
});
app.listen(3978, function () {
console.log('app listening on port 3978!');
});