-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathapp.js
46 lines (37 loc) · 1.19 KB
/
app.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
39
40
41
42
43
44
45
46
var express = require('express');
var path = require('path');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var Voxbone = require('voxbone-webrtc');
//Your Voxbone WebRTC credentials
var voxrtc_username = 'your_voxbone_webrtc_username';
var voxrtc_secret = 'your_voxbone_webrtc_secret';
//New Voxbone Object used for authentication
var voxbone = new Voxbone({
voxrtcUsername: voxrtc_username,
voxrtcSecret: voxrtc_secret
});
var app = express();
// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));
// Launch index view and pass the voxrtc_config key.
app.get('/', function(req, res) {
voxrtc_config = voxbone.generate();
username = voxrtc_username;
password = voxrtc_secret;
res.render('index');
});
// catch 404 and forward to error handler
app.use(function(req, res, next) {
var err = new Error('Not Found');
err.status = 404;
next(err);
});
module.exports = app;