I am implementing a laravel web application and I separately implementing a native mobile application as well. I need to use the same backend which I use for a web application for mobile application as well. How can I implement the backend as a REST API which can be called from a mobile application and also use for the web application as well?
1 Answer
there's a file located in routes/api.php.
You can store your API there like the way you implement your routes at web.php. But return JSON from your controller for your REST API.
you can call it like http://yourdomain/api/yourroute
2 Comments
lordyhas
do you have any example or tutorial, can you share the link of that please.
Wailan Tirajoh
daily-dev-tips.com/posts/laravel-basic-api-routes @lordyhas this maybe the most basic i can found on internet. hope it helps