[SOLVED] 405 Method Not Allowed using Angular 4's HttpClient

As @tstadler points out, it is probably the URL that is wrong. The message is misleading though.

You are using the simple CORS setup. In the first route a route is set up that matches all URLs, but only OPTION methods:

When you call a URL that Slim cannot match, you get an error message that the first route ($app->options) matches the URL, but not the method.

You can fix this be either using the middleware solution described in the documentation on CORS, or add a catch all route for the default methods that ensures you get a 404 if none of the non-option routes match.

// catch all route for unhandled routes
// NOTE: make sure this is the last defined route
$app->map(['GET', 'POST', 'PUT', 'DELETE', 'PATCH'], '/{routes:.+}', function($req, $res) {
        $handler = $this->notFoundHandler; // handle using the default Slim 404 handler
        return $handler($req, $res);
});