I'm trying to use router for my node app, but It doesn't work.
this is my code:
http = require 'http'
util = require 'util'
router = require 'router'
Modules = require './modules'
cson = require 'cson'
route = router()
route.get '/', (req, res) ->
res.writeHead(200)
res.end('hello index page')
http.createServer(route).listen(8080)
and the result is:
localhost:smoothic Filipe$ coffee app.coffee
/Users/Filipe/Desktop/Smoothic/node_modules/router/index.js:156
throw new TypeError('argument callback is required')
^
TypeError: argument callback is required
at Function.handle (/Users/Filipe/Desktop/Smoothic/node_modules/router/index.js:156:11)
at Server.router (/Users/Filipe/Desktop/Smoothic/node_modules/router/index.js:61:12)
at Server.emit (events.js:98:17)
at HTTPParser.parser.onIncoming (http.js:2108:12)
at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:121:23)
at Socket.socket.ondata (http.js:1966:22)
at TCP.onread (net.js:527:27)
I'm trying to use router for my node app, but It doesn't work.
this is my code:
and the result is: