klein/klein.php

Namespace using multiple countries

Opened this issue · 2 comments

I am trying to use namespaces for multiple countries and use the country to setup a service.

$klein->with("/[at|de:country]", function () use ($klein) {
    // catch all (not called)
    $klein->respond(function($request, $response, $service, $app) {
       // create service based on $request->country
    });
    // specific route, is called
    $klein->respond("articles", function($request, $response, $service, $app) {
    });
});

But the catch all route is never called. If I use $klein->with("/at", function () {});, the catch all route is called as well.

Does klein support using the OR operator for namespaces?

+1

I'm finding that catch-all routes in namespaces don't support any parameters, not just specifically the OR operator.