Adds routes closure

Esse commit está contido em:
Tim Fogarty
2013-11-23 18:33:59 +00:00
commit fbb177d804
3 arquivos alterados com 18 adições e 11 exclusões
+3 -1
Ver Arquivo
@@ -10,9 +10,11 @@ app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');
app.use(app.router);
app.use(express.static(__dirname + '/public'));
app.set('client', client);
app.get('/', routes.index);
app.get('/takeoff', routes.takeoff);
app.get('/takeoff', routes.takeoff(client));
app.get("/land", routes.land(client));
app.listen(3000, function(){
console.log("Server started on port 3000");
+14 -9
Ver Arquivo
@@ -1,13 +1,18 @@
exports.index = function(req, res){
res.render('index', {'title':'HI THERE'});
}
};
exports.takeoff = function(req, res){
console.log("Takeoff!");
client.takeoff();
}
exports.land = function(client){
return function(req, res) {
console.log("Land!");
client.land();
};
};
exports.takeoff = function(client){
return function(req, res) {
console.log("Takeoff!");
client.takeoff();
};
};
exports.land = function(req, res){
console.log("Land!");
client.land();
}
+1 -1
Ver Arquivo
@@ -54,6 +54,6 @@
<script src="../../assets/js/jquery.js"></script>
<script src="../../dist/js/bootstrap.min.js"></script>
<script src="../../annyang.min.js"></script>
<script src="../../voice.js"></script>
<script src="../../voice.js"></script>
</body>
</html>