-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 2ebf9bf
Showing
7 changed files
with
106 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
|
||
/** | ||
* Module dependencies. | ||
*/ | ||
|
||
var express = require('express') | ||
, app = express() | ||
, routes = require('./routes') | ||
, user = require('./routes/user') | ||
, server = require('http').createServer(app) | ||
, path = require('path') | ||
, io = require('socket.io').listen(server); | ||
|
||
|
||
|
||
// all environments | ||
app.set('port', process.env.PORT || 8888); | ||
app.use(express.favicon()); | ||
app.use(express.logger('dev')); | ||
app.use(express.bodyParser()); | ||
app.use(express.methodOverride()); | ||
app.use(app.router); | ||
app.use(express.static(path.join(__dirname, 'public'))); | ||
|
||
// development only | ||
if ('development' == app.get('env')) { | ||
app.use(express.errorHandler()); | ||
} | ||
|
||
app.get('/', function (req, res) { | ||
res.sendfile(__dirname + '/public/index.html'); | ||
}); | ||
|
||
server.listen(app.get('port'), function(){ | ||
console.log('Express server listening on port ' + app.get('port')); | ||
}); | ||
|
||
//Socket.io Server | ||
io.sockets.on('connection', function (socket) { | ||
socket.emit('news', { hello: 'world' }); | ||
socket.on('foobar', function (data) { | ||
console.log(data); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "GoogleTV-rPi", | ||
"version": "0.0.1", | ||
"private": false, | ||
"scripts": { | ||
"start": "node app.js" | ||
}, | ||
"dependencies": { | ||
"express": "3.1.1", | ||
"jade": "*", | ||
"socket.io":"0.9.14" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
body { | ||
padding: 50px; | ||
font: 14px "Lucida Grande", Helvetica, Arial, sans-serif; | ||
} | ||
|
||
a { | ||
color: #00B7FF; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Google TV</title> | ||
|
||
<link href="css/style.css" rel="stylesheet" type="text/css"> | ||
|
||
</head> | ||
<body> | ||
<h2>Google TV</h2> | ||
|
||
|
||
<script src="/socket.io/socket.io.js"></script> | ||
<script> | ||
|
||
var socket = io.connect('http://localhost:3000'); | ||
|
||
socket.on('news', function (data) { | ||
console.log(data); | ||
socket.emit('foobar', { my: 'data' }); | ||
}); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
/* | ||
* GET home page. | ||
*/ | ||
|
||
exports.index = function(req, res){ | ||
res.render('index', { title: 'Express' }); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
/* | ||
* GET users listing. | ||
*/ | ||
|
||
exports.list = function(req, res){ | ||
res.send("respond with a resource"); | ||
}; |