Skip to content
Myr

Added dsl.js

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

authored by visionmedia · committed by visionmedia · parent 28297a0 · Browse files · 3 files+39 added−36 removed
This commit

State

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

Diff stats

3 files+39 added−36 removed

  • other:+39 added−36 removed

3 files+39 added−36 removed

modified:lib/express/core.js+1 added-36 removed
1 unmodified line
2// Express - Core - Copyright TJ Holowaychuk <tj@vision-media.ca> (MIT Licensed)34process.mixin(require('sys'))5process.mixin(require('express/helpers'))6process.mixin(require('express/dsl'))78// --- ExpressError910ExpressError = Class({
165 unmodified lines
176 return '(.*?)'177 }), '/ [ ]') + '$', 'i')178}179179/**180 * Escape RegExp _chars_ in _string_. Where _chars_ 181 * defaults to regular expression special characters.182 *183 * _chars_ should be a space delimited list of characters,184 * for example '[ ] ( )'.185 *186 * @param {string} string187 * @param {string} chars188 * @return {Type}189 * @api public190 */191192escapeRegexp = function(string, chars) {193 var specials = (chars || '/ . * + ? | ( ) [ ] { } \\').split(' ').join('|\\')194 return string.replace(new RegExp('(\\' + specials + ')', 'g'), '\\$1')195}196197set = function(option, val) {198 return val == undefined ?199 Express.settings[option] :200 Express.settings[option] = val201}202203enable = function(option) {204 set(option, true)205}206207disable = function(option) {208 set(option, false)209}210211run = function() {212 Express.server.run()213}214180// --- Routing API181182get = view = route('get')183post = create = route('post')
2 unmodified lines
added:lib/express/dsl.js+20 added
modified:lib/express/helpers.js+18 added