Prabhat Jani
Prabhat Jani

Reputation: 1

How to use laravel application as both web application and Rest API

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?

Upvotes: 0

Views: 959

Answers (1)

Wailan Tirajoh
Wailan Tirajoh

Reputation: 534

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

Upvotes: 2

Related Questions