Skip to content
Myr

Added redirect()

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

authored by visionmedia · committed by visionmedia · parent 7a463ca · Browse files · 1 file+15 added−0 removed
This commit

State

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

Diff stats

1 file+15 added−0 removed

  • other:+15 added−0 removed

1 file+15 added−0 removed

modified:lib/express.core.js+15 added
159 unmodified lines
160 return hash161 },162 163 /**164 * Redirect to _url_.165 *166 * @param {string} url167 * @return {string}168 * @api public169 */170 171 redirect : function(url) {172 // TODO: respond / redirect should halt173 this.header('Location', url)174 return this.respond('Moved Temporarily')175 },176 177 /**178 * Set response status to _value_. Where value may be179 * a case-insensitive string such as 'Not Found', 'forbidden',180 * or a numeric HTTP response status code.181 *
390 unmodified lines
572573get(/articles\/(\d+)/, function(){574 header('Content-Type', 'text/html')575 'article id ' + captures[1]576 redirect('http://google.com') // TODO: remove / fix577})578579get('articles/:name', function(){580 if (param('name') == 'tj')
6 unmodified lines