A
A
Alexey Alekseev2018-12-29 03:20:47
API
Alexey Alekseev, 2018-12-29 03:20:47

How to properly organize a SPA + API application?

Hello.
I recently started learning node, express, javascript, vue, mongodb.
There is a third-party API server for a computer multiplayer game.
As a practice, I want to implement monitoring of game characters.

To get the necessary data about a character, you need to make several API requests:
1. get api/a
2. get api/b
3. get api/c
4. get api/d

One user can have many such characters.

As a backend I use node + express + mongodb
As a frontend vue

Example:
A user has 100 characters. It turns out that in order to update all the data of the characters, it is necessary to make 100 * 4 = 400 requests to the game API server.
Process the received data on your server, save to the database.
There may be several such users.
They can enter at the same time.

How to properly organize requests to the API server?

a) On the client side, send the received data to the server in order to save it to the database.
b) On the server side?
- if all requests are sent at the same time, the server can ban for a while
- if in order, then the user will have to wait a long time
c) A queue of requests on the server? For a long time?

ps It's even difficult for me to formulate a question =( In which direction to at least dig?
pss I tried it on myself, sent 100+ request requests at a time via node + express, it worked, but if in production?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stalker_RED, 2018-12-29
@Stalker_RED

One query cannot pull out all the data on a character?
One request can not pull out data for several characters at once?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question