Open
Description
Hello.
I saw curveball/core#92, but I must be missing something. I've got code like this:
// handler.ts
import { Application, invokeMiddlewares } from '@curveball/core';
import handler from '@curveball/aws-lambda';
import { fooRoutes } from './components/foo/routes';
const app = new Application();
app.use(ctx => invokeMiddlewares(ctx, fooRoutes));
export const router = handler(app);
// components/foo/routes.ts
import router from '@curveball/router';
import { fooController } from './controller'; // just has a "get" method
export const fooRoutes = [
router('/:id/foo', fooController),
];
The relevant bit of serverless.yml looks like so:
functions:
my-function:
handler: src/handler.router
events:
- http:
# sends everything through to the router
path: /{proxy+}
method: any
When I visit localhost:3000/12345/foo
, I get the expected result.
When I visit any other path (note: I've defined none), I get a 200 and an empty page. I would expect a 404 or a 405. Is handling of nonexistent routes not automagic? Did I miss a step?
If it's not handled automatically, is there a recommend best practice? (I didn't try too long, but a wildcard route didn't seem to do the trick either.)
Thanks!