M
M
Maxim Vlasov2020-09-27 13:07:37
API
Maxim Vlasov, 2020-09-27 13:07:37

How to make an API in the Laravel + Vue bundle?

I'm making an app that uses Vue. The page should receive the necessary data depending on the routing. The question arose: how to do it right? Those. if the page needs to be updated, for example, 5 components, then each of them will knock on the server API. And if there are 1000 or more clients at the same time? Then more than 5000 requests will be created to form one page. How are such APIs generally implemented? I have an idea like this: in Vuex there is a module, for example, pages, which will make 1 request to the API and scatter the incoming data to other modules. Do they do this with Vue routing?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey delphinpro, 2020-09-27
@tr0yka

I have an idea like this: in Vuex there is a module, for example, pages, which will make 1 request to the API and scatter the incoming data to other modules. Do they do this with Vue routing?

Hm.
And how will these endpoints look like in the API?
GET /api/pleaseGiveMeAllDataForPageOne
GET /api/pleaseGiveMeAllDataForPageTwo

Some kind of garbage .. How then to test this API?
And also extra, completely unnecessary Controllers / methods in the backend.

S
Sanes, 2020-09-27
@Sanes

You can collect data in Laravel and send it using a separate method.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question