-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
33 lines (25 loc) · 787 Bytes
/
server.js
File metadata and controls
33 lines (25 loc) · 787 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
29
30
31
32
// var stream = client.stream('statuses/filter', {track: 'javascript,nuclear', delimited:false});
const
express = require('express'),
app = express(),
server = require('http').Server(app),
io = require('socket.io')(server,{
origins:"*:*"
});
app.use('/node_modules', express.static(__dirname + '/node_modules/'));
app.use(express.static(__dirname + '/static'));
// route 127.0.0.1/client to client.html
app.get('/index', function(req, res){
res.sendFile(__dirname + '/index.html');
});
var stream;
io.on('connection', function(socket){
var tweetStore = require('./tweetStorage')(socket);
socket.on('watch',function(filter){
tweetStore.addLabel(filter);
});
socket.on('unwatch',function(filter){
tweetStore.removeLabel(filter);
});
});
server.listen(8080,"127.0.0.1");