Skip to content

Commit

Permalink
ref #11 - research how to integrate coffeescript files
Browse files Browse the repository at this point in the history
  • Loading branch information
opensas committed Mar 18, 2013
1 parent 654f69a commit 8dc78c1
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 21 deletions.
17 changes: 17 additions & 0 deletions webservice/controllers/ideaTypes.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

Model = require('../db.js').models.IdeaType

module.exports =

list: (req, res, next) ->
Model.findAll().success (models) ->
res.send models

count: (req, res, next) ->
Model.count().success (count) ->
res.send count.toString()

show: (req, res, next) ->
id = parseInt(req.params.id, 10)
Model.find(id).success (model) ->
res.send model
27 changes: 11 additions & 16 deletions webservice/controllers/ideaTypes.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions webservice/controllers/ideaTypes.js.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

var IdeaType = require('../db.js').models.IdeaType;

module.exports = {

list: function(req, res, next) {

IdeaType.findAll().success(function(ideaTypes) {
res.send(ideaTypes);
});

},

count: function(req, res, next) {

IdeaType.count().success(function(count) {
res.send(count.toString());
});

},

show: function(req, res, next) {

IdeaType.find(parseInt(req.params.id, 10)).success(function(ideaType) {
res.send(ideaType);
});

}

};
8 changes: 8 additions & 0 deletions webservice/controllers/ping.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

exports.ping = (req, res, next) ->

console.log 'got pinged! at', (new Date()).toString()

res.send
message: "Hi, I'm alive",
date: new Date()
6 changes: 2 additions & 4 deletions webservice/controllers/ping.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions webservice/controllers/ping.js.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

exports.ping = function(req, res, next) {

console.log('got pinged! at', (new Date()).toString());
res.send({
message: "Hi, I'm alive",
date: new Date()
});

};
3 changes: 2 additions & 1 deletion webservice/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"restify": "2.3.x",
"underscore": "1.4.x",
"sequelize": "1.4.x",
"require-dir": "x"
"require-dir": "x",
"coffee-script": "1.6.x"
},
"engine": "node >= 0.10.0"
}
5 changes: 5 additions & 0 deletions webservice/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pkill node

coffee --watch --compile --bare . &

nodemon --debug app.js

0 comments on commit 8dc78c1

Please sign in to comment.