forked from jamfang/Agora-Web-Tutorial-1to1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
executable file
·32 lines (27 loc) · 814 Bytes
/
index.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
var http = require('http');
var express = require('express');
var favicon = require('serve-favicon');
var PORT = process.env.PORT || 8080;
// Verify that the API Key and API Secret are defined
if (!(process.env.APP_ID)) {
throw new Error('You must define an APP_ID');
process.exit();
}
// Get the AppID
var APP_ID = process.env.APP_ID;
var app = express();
app.disable('x-powered-by');
app.set('port', PORT);
app.use(favicon(__dirname + '/public/images/favicon.ico'));
app.use(express.static(__dirname + '/public'));
app.get('/app_id', function(req, res){
if (!APP_ID){
res.send(500, {
error: "No APP_ID"
});
}
res.send(APP_ID)
})
http.createServer(app).listen(app.get('port'), function() {
console.log('Agora Web Quickstart starts at ', app.get('port'));
});