urgot
Advanced tools
Comparing version 1.3.3 to 1.3.4
@@ -1,4 +0,3 @@ | ||
class App { | ||
export class App { | ||
context; | ||
static routes = []; | ||
/** | ||
@@ -16,3 +15,2 @@ * 实例化后触发 | ||
} | ||
export { App }; | ||
export default (apps, options) => { | ||
@@ -30,10 +28,10 @@ const routes = {}; | ||
for (const metaMethod of method.__$routes) { | ||
const route = `${prefix}${metaMethod.route === '' && prefix === '' ? '/' : metaMethod.route}`; | ||
if (!routes[route]) | ||
routes[route] = {}; | ||
if (routes[route][metaMethod.method]) { | ||
console.warn('[urgot]', 'route duplication', `${metaMethod.method} ${route}`); | ||
const link = `${prefix}${metaMethod.route === '' && prefix === '' ? '/' : metaMethod.route}`; | ||
if (!routes[link]) | ||
routes[link] = {}; | ||
if (routes[link][metaMethod.method]) { | ||
console.log('Duplicate route definition', metaMethod.method, link); | ||
continue; | ||
} | ||
routes[route][metaMethod.method] = { instance: app, name: methodName }; | ||
routes[link][metaMethod.method] = { instance: app, name: methodName }; | ||
} | ||
@@ -40,0 +38,0 @@ } |
{ | ||
"name": "urgot", | ||
"version": "1.3.3", | ||
"version": "1.3.4", | ||
"description": "a Node.js web framework", | ||
@@ -5,0 +5,0 @@ "type": "module", |
28635
748