forked from island205/technode-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
25 lines (18 loc) · 613 Bytes
/
app.js
File metadata and controls
25 lines (18 loc) · 613 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
//http://www.readability.com/articles/ye13gync
var express = require('express')
var gravatar = require('gravatar')
var app = express();
var port = process.env.PORT || 3000
var fs = require('fs')
app.use(express.static(__dirname + '/static'))
var indexPage = fs.readFileSync('./static/index.html')
app.use(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/html'})
res.write(indexPage)
res.end()
})
var io = require('socket.io').listen(app.listen(port))
io.sockets.on('connection', function (socket) {
require('./socket')(socket, io)
})
console.log("TechNode is on port " + port + '!')