Skip to content

Commit

Permalink
Bootstrap 3.1.x/Express 4.x
Browse files Browse the repository at this point in the history
  • Loading branch information
itwars committed Apr 15, 2014
1 parent 2265588 commit b830787
Show file tree
Hide file tree
Showing 16 changed files with 143 additions and 7,423 deletions.
14 changes: 14 additions & 0 deletions README.md
@@ -1,3 +1,17 @@
Build an effective *Twitter stream client* on top of **NodeJS, using Socket.io and Twitter Bootstrap** with few node.js lines of code! That's the way I track **node.js news**!

![Twitter Stream WebApp](/img/screenshot.jpg "Twitter Stream with Bootstrap and node.js")

Clone the repository and in the dashboard.js source code add you own Twitter credentials :

```bash
git clone https://github.com/itwars/twitter-stream.git

npm install

chmod+x dashboard.js

./dashboard.js
```

See [NodeJS-News](http://www.nodejs-news.com/nodejs-tech/twitter-nodejs-bootstrap/) web site for details.
33 changes: 22 additions & 11 deletions dashboard.js 100644 → 100755
@@ -1,20 +1,24 @@
#!/usr/bin/env node

sys = require('util');
express = require('express');
http = require('http');
twitter = require('ntwitter');

app = express.createServer();
app.configure(function(){
app = express();
//app.configure(function(){
app.use(express.static(__dirname + '/public'));
});
//});

app.get('/', function(req, res, next){
res.render('/public/index.html');
});
app.listen(8081);
server = http.createServer(app)
server.listen(8081);
console.log('Server running at http://localhost:8081/');

var io = require('socket.io').listen(app);
io.set('log level', 1);
var io = require('socket.io').listen(server);
io.set('log level', 0);

myList = [];
Array.prototype.del = function(val) {
Expand All @@ -32,9 +36,15 @@ io.sockets.on('connection', function(socket) {
if(action==='+') {
myList.push(data);
}
else {
if(action==='-') {
myList.del(data);
}
if(action==='*') {
twit.updateStatus(data,
function (err, data) {
// console.log(data);
});
}
});
socket.on('getfilter', function() {
socket.emit('pushfilter', myList);
Expand All @@ -50,9 +60,10 @@ io.sockets.on('connection', function(socket) {

function CreateTwitter() {
twit = new twitter({
consumer_key: '',
consumer_secret: '',
access_token_key: '',
access_token_secret: ''

consumer_key: '',
consumer_secret: '',
access_token_key: '',
access_token_secret: ''
});
}
Binary file added img/screenshot.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions package.json
@@ -0,0 +1,21 @@
{
"name": "twitter-stream",
"description": "Real-time Twitter Streams webapp",
"homepage": "http://nodejs-news.com",
"keywords": [
"websocket",
"socket",
"realtime",
"socket.io",
"twitter"
],
"author": {
"name": "Vincent RABAH",
"email": "vincent.rabah@gmail.com"
},
"dependencies": {
"socket.io": "0.9.16",
"ntwitter": "0.5.0",
"express": "4.0.0"
}
}

0 comments on commit b830787

Please sign in to comment.