Level 39
routes go in the boot method, not the register method. If that still doesn't work with your current setup, use this from the docs in the boot method.
Put them into a routes file and then use $this->loadRoutesFrom(__DIR__ . '/routes.php');
Hi,
In my package I'm testing an api endpoint, but I always get a 404 response!?!?
Here is the file (see unsuccessfulLogin method):
$this->post('/under/check', ['code' => 1235])
In my service provider:
$routeConfig = [
'namespace' => 'LarsJanssen\UnderConstruction\Controllers',
'prefix' => 'under',
'middleware' => [
'web',
],
];
$this->getRouter()->group($routeConfig, function ($router) {
$router->post('check', [
'uses' => 'CodeController@check',
'as' => 'underconstruction.check',
]);
$router->get('construction', [
'uses' => 'CodeController@index',
'as' => 'underconstruction.index',
]);
$router->get('js', [
'uses' => 'AssetController@js',
'as' => 'underconstruction.js',
]);
});
I register these routes! And in postman it's working. So why is it not working in my test?
Please or to participate in this conversation.