Question By
Unsolved

Nina Media Laravel API route

chief-don

Jan 12th, 2018 04:46 PM

Hi, I am trying to add a route to the api which gets data from a controller and returns a json. can someone please explain to me how I could add such a thing. or provide a simple example?

there is an example which looks like this:

Route::get('/user', function (Request $request) { return $request->user(); })->middleware('auth:api');

but It doesn't seem to work using Postman

thank you very much!

mark

Feb 1st, 2018 09:01 AM

What seems to be the issue with postman?

Also are you addind this to the web.php or the api.php route file?

chief-don

Feb 1st, 2018 06:09 PM

Hi, I've managed to add most of the routes I need in api.php file,

the only thing I'm struggling with now is the login process,

How can I create a route which will generate a token?

thanks!

mark

Feb 7th, 2018 09:49 AM

For that you will most likely need to use something like Passport.