*/
start : function(port) {
this.server.listen(port || 3000, function(request, response){
Express.callRouteFor(request)
response.sendHeader(Express.response.status, Express.hashToArray(Express.response.headers))
response.sendBody(Express.response.body || '')
response.finish()
})
return array
},
/**
* Return hash generated from an
* associative array.
*
* @param {array} array
* @return {hash}
* @api public
*/
arrayToHash : function(array) {
var hash = {}
for (var i = 0, len = array.length; i < len; ++i)
hash[array[i][0]] = array[i][1]
return hash
},
/**
* Set response status to _value_. Where value may be
* a case-insensitive string such as 'Not Found', 'forbidden',
* or a numeric HTTP response status code.
*
contentsOf : function(body) {
return body.toString().match(/^[^\{]*{((.*\n*)*)}/m)[1]
},
dump : function(object) {
puts(JSON.stringify(object))
},
callRouteFor : function(request) {
// method GET
// uri.directory
// uri.path
// uri.relative
// uri.source
// uri.params
// headers [[foo, bar]]
var route = findRouteFor(request)
},
findRouteFor : function(request) {
},
routeFunctionFor : function(method) {
}
}
get = Express.routeFunctionFor('get')
post = Express.routeFunctionFor('post')
})()
No newline at end of file
})()
Express.response.body = 'test'
Express.start()
No newline at end of file