robtweed/qewd

Question about DELETE route for master-koa

killmenot opened this issue · 3 comments

Hi @robtweed

Please take a look:

qewd/lib/master-koa.js

Lines 151 to 164 in b74a7c5

match = 'POST ' + path + '/:type/*';
koaRouter.addRoute(match, args);
match = 'POST ' + path + '/:type';
koaRouter.addRoute(match, args);
match = 'DELETE ' + path + '/:type/*';
koaRouter.addRoute(match, args);
match = 'PUT ' + path + '/:type';
koaRouter.addRoute(match, args);
match = 'PUT ' + path + '/:type/*';
koaRouter.addRoute(match, args);

All verbs are used two times for '/:type and '/:type/*' but DELETE is used only once (for '/:type/*'). Is it correct?

The second question related to this snippet of the code is:
all routes runs in order:
1 - 'VERB ' + path + '/:type'
2 - 'VERB ' + path + '/:type/*'

but POST in
1 - 'VERB ' + path + '/:type/*'
2 - 'VERB ' + path + '/:type'

Is it correct?

You're right - the DELETE should appear twice like the others

Regarding your second question, the order shouldn't matter, but align them if you wish