Now we are ready to run our API so run below command to quick run:
php artisan serve
you will get an url something like this http://localhost:8000 or http://127.0.0.1:8000
Step 4: Test API
To test the API, use a tool called Postman, you may have different IP and port number and after the port number, you should use this /api/auth/signup
NOTE: If you want to Interact with this api from the frontend (i.e. vuejs), then you need to follow the below steps
Step 5: Set the URL
From 2nd step you will get an URL which looks something like this http://localhost:8000 or http://127.0.0.1:8000
Create a webServices folder at location resources/js/
Create a file named index.js
Then you have to place this http://127.0.0.1:8000 url in resources/js/webServices/index.js rest of the parameters will remain same.
import axios from 'axios';
let webService = axios.create({
baseURL: 'http://127.0.0.1:8000/api/auth'
});
export default webService;
5. For signup with laravel-passport, Go to location resources->js->views->session->SignUpOne.vue and add the sign up with laravel passport as shown in screenshot:
6. For login with laravel-passport, Go to location resources->js->views->session->LoginOne.vue and add the login with laravel passport button as mentioned in screenshot.
7. Call the signupWithLaravel method as you have defined on the button click in the SignUpOne.vue file and write following lines of code .