(function(){
Express = { version : '0.0.1' }
})()
// new node.http.Server(function (req, res) {
// res.sendHeader(200, [["Content-Type", "text/plain"]])
// res.sendBody("Hello World")
// res.finish()
// }).listen(8000)
//
// puts("Server running at http://localhost:8000/")
//
Express = {
version : '0.0.1',
/**
* Start express, binding to _port_.
*
* @param {int} port
* @api public
*/
start : function(port) {
this.server.listen(port || 3000, function(request, response){
response.sendHeader(200, [['Content-Type', 'text/plain']])
response.sendBody('Testing')
response.finish()
})
},
server : {
/**
* Listen to _port_ with _callback_.
*
* @param {int} port
* @param {function} callback
* @api private
*/
listen : function(port, callback) {
new node.http.Server(callback).listen(port)
puts('Express running at http://localhost:' + port)
}
},
/**
* Return the contents of a function body.
*
* @param {function} body
* @return {string}
* @api public
*/
contentsOf : function(body) {
return body.toString().match(/^[^\{]*{((.*\n*)*)}/m)[1]
}
}
Express.start()
})()
No newline at end of file