UNPKG

@teclone/r-server

Version:

A lightweight, extensible web-server with inbuilt routing-engine, static file server, file upload handler, request body parser, middleware support and lots more

44 lines (38 loc) 1.56 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); // this matches a route token path in the form of {dataType:pathParameterName} or {pathParameterName} var singleToken = '\\{((?:[a-z]+:)?[a-z]+)\\}'; // single token regex var SINGLE_TOKEN_REGEX = new RegExp(singleToken, 'i'); // double token regex, helps capture routh tokens that targets two pairs of from and to values // eg {dataType:fromPathParameterName}-{dataType:toPathParameterName} // or {dataType:fromPathParameterName}.{dataType:toPathParameterName} var DOUBLE_TOKEN_REGEX = new RegExp(singleToken + '([-.])' + singleToken, 'i'); var ERROR_LEVELS = { WARNING: 'WARNING', FATAL: 'FATAL' }; var ALLOWED_METHODS = ['OPTIONS', 'HEAD', 'GET', 'POST', 'PUT']; var CRLF = '\r\n'; var BLANK_LINE = CRLF + CRLF; var routeId = 0; var middlewareId = 0; var assignRouteId = function assignRouteId() { return ++routeId; }; var assignMiddlewareId = function assignMiddlewareId() { return ++middlewareId; }; var ALL_METHODS = ['options', 'head', 'get', 'post', 'put', 'delete']; var DEFAULT_CONFIG_FILE = '.server.config.js'; exports.ALLOWED_METHODS = ALLOWED_METHODS; exports.ALL_METHODS = ALL_METHODS; exports.BLANK_LINE = BLANK_LINE; exports.CRLF = CRLF; exports.DEFAULT_CONFIG_FILE = DEFAULT_CONFIG_FILE; exports.DOUBLE_TOKEN_REGEX = DOUBLE_TOKEN_REGEX; exports.ERROR_LEVELS = ERROR_LEVELS; exports.SINGLE_TOKEN_REGEX = SINGLE_TOKEN_REGEX; exports.assignMiddlewareId = assignMiddlewareId; exports.assignRouteId = assignRouteId; //# sourceMappingURL=Constants.js.map