When I do a GET '/api/me/apps/myapp/data/user' which should match the route ':app/data/:scope/:key' however it generated this error:
MethodError: Method not allowed
at REQUEST.parseRequest (/var/task/node_modules/lambda-api/lib/request.js:247:13)
at API.run (/var/task/node_modules/lambda-api/index.js:220:21)
at Runtime.module.exports.handle [as handler] (/var/task/functions/controller/api.js:17:22)
at Runtime.handleOnce (/var/runtime/Runtime.js:66:25) {
method: 'GET',
path: '/api/me/apps/myapp/data/user'
}
When rendering a full list of routes, this is returned:
╟──────────┼─────────────────────────────────────────────────────────────────────────╢
║ PUT │ /api/me/apps/:app/data ║
╟──────────┼─────────────────────────────────────────────────────────────────────────╢
║ GET │ /api/me/apps/:app/data ║
╟──────────┼─────────────────────────────────────────────────────────────────────────╢
║ DELETE │ /api/me/apps/:app/data/user/:key ║
╟──────────┼─────────────────────────────────────────────────────────────────────────╢
║ PUT │ /api/me/apps/:app/data/user/:key/:value ║
╟──────────┼─────────────────────────────────────────────────────────────────────────╢
║ GET │ /api/me/apps/:app/data/:scope ║
╟──────────┼─────────────────────────────────────────────────────────────────────────╢
║ GET │ /api/me/apps/:app/data/:scope/:key ║
╟──────────┼─────────────────────────────────────────────────────────────────────────╢
So I'd say it should work just fine however it doesn't. However when I remove the "DELETE" and "PUT" methods from code, the GET route starts working. So it seems like the matching doesn't fully work when using nested routes.
I'm using register() on multiple depths, to illustrate it's something like this:
api.js:
api/user.js:
api/user/app.js:
When I do a GET '/api/me/apps/myapp/data/user' which should match the route ':app/data/:scope/:key' however it generated this error:
MethodError: Method not allowed at REQUEST.parseRequest (/var/task/node_modules/lambda-api/lib/request.js:247:13) at API.run (/var/task/node_modules/lambda-api/index.js:220:21) at Runtime.module.exports.handle [as handler] (/var/task/functions/controller/api.js:17:22) at Runtime.handleOnce (/var/runtime/Runtime.js:66:25) { method: 'GET', path: '/api/me/apps/myapp/data/user' }
When rendering a full list of routes, this is returned:
So I'd say it should work just fine however it doesn't. However when I remove the "DELETE" and "PUT" methods from code, the GET route starts working. So it seems like the matching doesn't fully work when using nested routes.