server
Advanced tools
Comparing version 1.0.33 to 1.0.34
{ | ||
"name": "server", | ||
"version": "1.0.33", | ||
"version": "1.0.34", | ||
"description": "A modern and powerful server for Node.js", | ||
@@ -72,3 +72,3 @@ "homepage": "https://serverjs.io/", | ||
"grunt-contrib-jshint": "^1.1.0", | ||
"grunt-contrib-pug": "^1.0.0", | ||
"grunt-contrib-pug": "^3.0.0", | ||
"grunt-contrib-watch": "^1.0.0", | ||
@@ -78,6 +78,6 @@ "grunt-sass": "^3.1.0", | ||
"jstransformer-marked": "^1.0.2", | ||
"node-sass": "^4.13.1", | ||
"node-sass": "^6.0.1", | ||
"picnic": "^6.4.0", | ||
"request-promises": "^1.0.1", | ||
"supertest": "^3.0.0" | ||
"supertest": "^3.4.2" | ||
}, | ||
@@ -84,0 +84,0 @@ "jest": { |
@@ -9,3 +9,2 @@ const join = require('../src/join'); | ||
module.exports = (method, ...all) => { | ||
// Extracted or otherwise it'd shift once per call; also more performant | ||
@@ -18,3 +17,2 @@ const { path, middle } = parse(all); | ||
return async ctx => { | ||
// A route should be solved only once per request | ||
@@ -32,9 +30,10 @@ if (ctx.req.solved) return; | ||
// Perform this promise chain | ||
await join(middle)(ctx); | ||
ctx.req.solved = true; | ||
if (!ctx.res.headersSent) { | ||
ctx.res.end(); | ||
} | ||
await join(middle, ctx => { | ||
// Only solve it if all the previous middleware succeeded | ||
ctx.req.solved = true; | ||
if (!ctx.res.headersSent) { | ||
ctx.res.end(); | ||
} | ||
})(ctx); | ||
}; | ||
}; |
@@ -5,10 +5,13 @@ const join = require('../src/join'); | ||
const full = ctx.req.subdomains.reverse().join('.'); | ||
if ((typeof path === 'string' && path === full) || | ||
(path instanceof RegExp && path.test(full))) { | ||
await join(middle)(ctx); | ||
ctx.req.solved = true; | ||
if (!ctx.res.headersSent) { | ||
ctx.res.end(); | ||
} | ||
if ( | ||
(typeof path === 'string' && path === full) || | ||
(path instanceof RegExp && path.test(full)) | ||
) { | ||
await join(middle, ctx => { | ||
ctx.req.solved = true; | ||
if (!ctx.res.headersSent) { | ||
ctx.res.end(); | ||
} | ||
})(ctx); | ||
} | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
793883
4024