Skip to content

Commit

Permalink
deploying
Browse files Browse the repository at this point in the history
  • Loading branch information
d0nd3r3k committed May 26, 2013
0 parents commit 2ebf9bf
Show file tree
Hide file tree
Showing 7 changed files with 106 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
44 changes: 44 additions & 0 deletions app.js
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);
});
});
13 changes: 13 additions & 0 deletions package.json
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"
}
}
8 changes: 8 additions & 0 deletions public/css/style.css
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;
}
24 changes: 24 additions & 0 deletions public/index.html
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>
8 changes: 8 additions & 0 deletions routes/index.js
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' });
};
8 changes: 8 additions & 0 deletions routes/user.js
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");
};

0 comments on commit 2ebf9bf

Please sign in to comment.