如何构build一个Cakefile来运行node.js
目前,我正在通过“ 在24小时内自学Node.js ”的方式,我希望尽可能在CoffeeScript而不是JavaScript中执行尽可能多的代码。
安装coffee-script
和node
。
我还是新来的蛋糕开发系统 – 有人可以指示我如何把Cakefile
加载到一个简单的服务器,如server.coffee
为了运行演示代码?
你可以在Cakefile中使用Node的API的任何部分,包括执行命令的child_process
。
有了child_process.spawn()
,你应该可以使用:
task 'server', 'Start up the server', (options) -> spawn = require('child_process').spawn child = spawn 'coffee', [ "#{__dirname}/server" ] child.on 'error', console.error child.on 'exit', -> console.log('exit')