Skip to content
Myr

Added app.listen() as a shortcut for http.createServer(app).listen()

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent 7a7d77e · Browse files · 2 files+44 added−10 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+44 added−10 removed

  • tests:+18 added−0 removed
  • other:+26 added−10 removed

2 files+44 added−10 removed

modified:lib/application.js+26 added-10 removed
14 unmodified lines
15 , View = require('./view')16 , url = require('url')17 , utils = connect.utils18 , path = require('path')19 , http = require('http')20 , join = path.join21 , fs = require('fs')22 , qs = require('qs');23
156 unmodified lines
180 * mounted applications.181 *182 * @param {String|Function|Server} route183 * @param {Function|Server} middleware183 * @return {Server} for chaining184 * @return {app} for chaining185 * @api public186 */187188app.use = function(route, middleware){
50 unmodified lines
239 *240 * app.use(blog);241 *242 * @param {Function} fn242 * @return {Server} for chaining243 * @return {app} for chaining244 * @api public245 */246247app.mounted = function(fn){
13 unmodified lines
261 * app.engine('html', require('ejs').render);262 *263 * @param {String} ext264 * @param {Function} fn264 * @return {Server} for chaining265 * @return {app} for chaining266 * @api public267 */268269app.engine = function(ext, fn){
56 unmodified lines
326 * at [express-params](http://github.com/visionmedia/express-params).327 *328 * @param {String|Array|Function} name329 * @param {Function} fn329 * @return {Server} for chaining330 * @return {app} for chaining331 * @api public332 */333334app.param = function(name, fn){
25 unmodified lines
360 * Register the given callback `fn` for the given `type`.361 *362 * @param {String} type363 * @param {Function} fn363 * @return {Server} for chaining364 * @return {app} for chaining365 * @api public366 */367368app.is = function(type, fn){
52 unmodified lines
421/**422 * Enable `setting`.423 *424 * @param {String} setting424 * @return {Server} for chaining425 * @return {app} for chaining426 * @api public427 */428429app.enable = function(setting){
3 unmodified lines
433/**434 * Disable `setting`.435 *436 * @param {String} setting436 * @return {Server} for chaining437 * @return {app} for chaining438 * @api public439 */440441app.disable = function(setting){
4 unmodified lines
446 * Redirect `key` to `url`.447 *448 * @param {String} key449 * @param {String} url449 * @return {Server} for chaining450 * @return {app} for chaining451 * @api public452 */453454app.redirect = function(key, url){
22 unmodified lines
477 * });478 *479 * @param {String} env...480 * @param {Function} fn480 * @return {Server} for chaining481 * @return {app} for chaining482 * @api public483 */484485app.configure = function(env, fn){
5 unmodified lines
491 return this;492};493494/**495 * Listen for connections.496 *497 * This method takes the same arguments498 * as node's `http.Server#listen()`. 499 *500 * @return {http.Server}501 * @api public502 */503504app.listen = function(){505 var server = http.createServer(this);506 return server.listen.apply(server, arguments);507};508509/**510 * Delegate `.VERB(...)` calls to `.route(VERB, ...)`.511 */512513methods.forEach(function(method){
10 unmodified lines
524 * middleware, and callback to _every_ HTTP method.525 *526 * @param {String} path527 * @param {Function} ...512 * @return {Server} for chaining528 * @return {app} for chaining529 * @api public530 */531532app.all = function(path){
74 unmodified lines
added:test/app.listen.js+18 added