E
E
egyptForce2019-01-18 22:04:05
JavaScript
egyptForce, 2019-01-18 22:04:05

Structure of a Vue/Vuex app?

When reading various manuals on the structure of client applications, among other folders, they mention such a folder as /services. And damn it, in 90% of these manuals, the contents of this folder are described as: api, etc. And nowhere is this mysterious, etc., deciphered. Who is experienced, tell me what you need to put in this / services? I understand that maybe everything depends on the project, but in a broad sense, what is this folder for?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
grinat, 2019-01-19
@egyptForce

There should be classes that encapsulate some logic, for example, for working with api. And the folder is empty, because there are stores, there are mixins that act as services. In Angular 2+, for example, there is no store, but there are services, they are usually made as singletons, injected into components and through them they request data changes, and also subscribe to this very data, the services folder is always packed there. Further, if you have two components that cannot be made one, but they have similar tasks, then in Angular you need to create a service and keep the logic in it (for example, a service for tracking scrolling), in Vue there are mixins for this.

F
Froggyweb, 2019-01-18
@Froggyweb

This is for educational projects. there the data which gives the server.
The answer was in the question described as: api etc. Do you know what an API is?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question