lark-router
Advanced tools
Comparing version 1.1.2 to 1.2.0
@@ -46,2 +46,8 @@ /** | ||
}); | ||
router.get('/bar', async (req, res) => { | ||
await new Promise(resolve => setTimeout(resolve, 1000)); | ||
res.body.push(Date.now()); | ||
await new Promise(resolve => res.end(res.body.join(', ') + '\n', resolve)); | ||
}); | ||
/* | ||
router.get('/bar', (req, res) => new Promise((resolve, reject) => { | ||
@@ -56,3 +62,4 @@ setTimeout(() => { | ||
})); | ||
*/ | ||
module.exports = http.createServer(router.routes()).listen(3000, () => debug('async http apps listening on 3000 ...')); |
@@ -139,4 +139,4 @@ /** | ||
route (method, pathexp, handler) { | ||
debug('setting route for [' + method + '] [' + pathexp + '] ...'); | ||
assert('string' === typeof method, 'Method must be a string!'); | ||
debug('setting route for [' + method.toUpperCase() + '] [' + pathexp + '] ...'); | ||
method = method.toLowerCase(); | ||
@@ -174,3 +174,3 @@ assert(this._methods.includes(method), 'Invalid Method!'); | ||
this.emit('error', e, req, ...args); | ||
throw e; | ||
// throw e; | ||
}); | ||
@@ -177,0 +177,0 @@ } |
{ | ||
"name": "lark-router", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"description": "An koa route initialization and configuration module.", | ||
"main": "index.js", | ||
"engines": { | ||
"node": ">=6.4.0" | ||
"node": ">=7.6" | ||
}, | ||
"scripts": { | ||
"test": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- --require should --recursive test", | ||
"_test": "./node_modules/.bin/mocha --require should test/" | ||
"test": "./node_modules/.bin/eslint example/** lib/** && ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- --require should --recursive test", | ||
"debug": "node --inspect-brk=9229 example/app.js" | ||
}, | ||
@@ -36,3 +36,4 @@ "repository": { | ||
"devDependencies": { | ||
"istanbul": "^0.4.5", | ||
"eslint": "^3.18.0", | ||
"istanbul": "^1.1.0-alpha.1", | ||
"koa": "^2.0.0-alpha.6", | ||
@@ -39,0 +40,0 @@ "lodash": "^4.16.2", |
@@ -104,2 +104,3 @@ lark-router | ||
router.get('/', () => new Promise(...)); | ||
router.get('/foo', async () => { ... }); | ||
``` | ||
@@ -149,2 +150,3 @@ | ||
``` | ||
/main.as.index.js => / | ||
/foo.as.param/bar.as.param.js => /:foo/:bar | ||
@@ -151,0 +153,0 @@ /foo/bar.as.asterisk.js => /foo/:bar* |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42269
33
936
163
7