-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathweb.js
More file actions
28 lines (21 loc) · 716 Bytes
/
web.js
File metadata and controls
28 lines (21 loc) · 716 Bytes
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
if(typeof window === 'undefined')
window = global; // write once run everywhere
var express = require('express');
var app = express();
var server = require('http').createServer(app);
var client = require('bsPeer').bspeer;
client.startServer(server);
app.configure(function () {
// Show Errors Oppan Java Style
app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
// Static Files Folder
app.use(express.static(__dirname + '/public'));
});
app.get('/', function(request, response) {
response.setHeader("Content-Type", "text/html");
response.sendfile('index.html');
});
var port = process.env.PORT || 8080;
server.listen(port, function() {
console.log("Listening on " + port);
});