How to separate a web system with API in domains?

Asked

Viewed 242 times

-1

Assuming I have to develop 1 app and 2 dashboards, the mobile app is powered by an api developed in php (which is managed by one of these dashboards), and the other dashboard connects to the app. The 2 panels are web.

Example:

The user logs into the app and checks in at the barber shop, the barbershop controls his clients through the dashboard and I manage the 2 through my dashboard.

Doubts:

The API and the 2 panels can be developed in the same project of the Laravel being accessed separately by subdomain or it is better to develop and host each separately?

It is safe to use the same domain for multiple systems, taking into account that payments will be used?

  • 1

    You can put everything together, Laravel has a domain option on your router. If the rest is safe, the domain matters little

2 answers

1

0

Laravel has 4 types of routes: WEB, API, Console and Channel, when using the web is the default to access the routes via browser the API route is for you to use the prefix /api before each request and so it separates web routes with the API so it can use both data on the system and an application.

Example: http://dominio.com.br/api/clientes.

In the example it is returning all clients via API and will use this way in your application of course it has the Auth:api that is Laravel das Apis authentication that is an Api_token that it asks you to generate to allow access to the API data, also has the JWT(Json Web Token) which is widely used in Laravel.

I hope to have helped you in something any doubt comment there.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.