Route paths migrating from v3 to v4

Why this code was working in v3 and now is not in v4?

$app->get("/elements", API\GetElements::class);

To make it work I had to change it to

$app->get(“/api/elements", API\GetElements::class);

but I don’t understand the reason.

Try to set the base path first:

1 Like

Thanks @odan. I know how to fix it. My question is why it was working before and it doesn’t now?

I use Apache and I’ve always had this behavior, even in Slim 3.

I hadn’t. After migrating to v4 got plenty of 404s because of that. I added your suggestion to define the base path, but that’s something that should appear in the docs. Can’t see it there (setBasePath() I mean).