I am a laravel beginner. I am building a PHP backend using laravel that will serve multiple platforms. I want to make an api that multiple platforms can use. This is what I am thinking of doing:
my api can be accessed like this: URL.com/api/v1/login
(this responds in JSON)
and , if it a web version, login can be accessed from URL.com/login
.This should display a form which will send an AJAX request to
URL.com/api/v1/login
I am thinking of setting up different routes for this. something like :
routes::post(api/v1/login,"whatever controller")
and
routes::get(login,"login_controller_which_will_send_ajax_requests_to the_above_controller")
I would like to ask something like this is recommended. if not, what is a better way to implement this