A
A
Alexander Koregin2020-02-07 13:46:00
Laravel
Alexander Koregin, 2020-02-07 13:46:00

How to set up routes correctly?

I want to set up Middleware Api routes, but I get a 404 error. It seems to me that I did not specify the path correctly. The path to the files starts with Auth and I don't understand how to substitute ['namespace' => 'Auth'] there. Can you suggest how to do it right?

Route::group(['prefix' => 'api', 'middleware' => ['api.auth']], function() {
    Route::post("/login", ['Auth' => '[email protected]']);
    Route::post("/logout", ['Auth' => '[email protected]']);
});

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Koregin, 2020-02-07
@dragonika8

I fixed it myself

Route::group(['namespace' => 'Auth', 'middleware' => ['api']], function() {
    Route::post('/signup', ['uses' => '[email protected]']);
    Route::post("/login", ['uses' => '[email protected]']);
    Route::post("/logout", ['uses' => '[email protected]']);
});

E
Eugene, 2020-02-07
@Nc_Soft

https://laravel.com/docs/6.x/routing#route-group-n...
https://laravel.com/docs/6.x/controllers#controlle...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question