Open gclinux opened 7 years ago
test1 router.use('/test', require('./test').routes(), require('./test').allowedMethods()); /test -->ok /test2-->404
router.use('/test', require('./test').routes(), require('./test').allowedMethods());
test2: router.use(['/test','test2'], require('./test').routes(), require('./test').allowedMethods()); /test -->404 /test2-->404
router.use(['/test','test2'], require('./test').routes(), require('./test').allowedMethods());
test3
router.use('/test', require('./test').routes(), require('./test').allowedMethods()); router.use('/test2', require('./test').routes(), require('./test').allowedMethods());
/test->404 /test2-->404
test.js:
var router = require('koa-router')(); router.get('/', async function (ctx, next) { ctx.body='ok' }) module.exports = router;
how to make both the /test and /test2 can be accesss
test1
router.use('/test', require('./test').routes(), require('./test').allowedMethods());
/test -->ok /test2-->404test2:
router.use(['/test','test2'], require('./test').routes(), require('./test').allowedMethods());
/test -->404 /test2-->404test3
/test->404 /test2-->404
test.js:
how to make both the /test and /test2 can be accesss