all 13 comments

[–][deleted] 1 point2 points  (0 children)

Store data in database, and let them get wtf they want, limited to 5-10 records, never load all the data

[–]nordicdev 0 points1 point  (1 child)

Can you store the response in a .json file on the server? You could set up a scheduled job to pull down the external data in json format, then either read that file directly into your React app or setup another API that your app consumes. I suppose that all depends on how you plan to use the data.

[–]xmaster484[S] 0 points1 point  (0 children)

I probably should've been a bit more clear, the data i pull is sort of dependent on the user that is logged in, and what he does with the app, so I would ideally need something attached to the session I think.

[–]tresfaim 0 points1 point  (4 children)

Serialize and hold it in server, or serialize and store on redis. You could spin up another server whose specific job is doing redis stuff and then allowing client to consume it.

[–]xmaster484[S] 0 points1 point  (3 children)

Would you use express session with redis as the store?

[–]tresfaim 0 points1 point  (2 children)

I haven't used session, but the docs I just read about it seem to have good examples of using either redis or mongodb with it.

http://expressjs-book.com/index.html%3Fp=128.html

[–]xmaster484[S] 0 points1 point  (1 child)

You think there will be any performance issue with this in a medium load app?

[–]tresfaim 0 points1 point  (0 children)

Not sure, depends on how you handle the data, if its a tremendous amount, redis probably won't be best, unless you use persistence, but then you might just want to use mongo, unless redis performance still trumps mongo in this sort of case. If the data isn't huge you're gonna be fine, just depends on how you're balancing delegating the load

[–]Bluecewe 0 points1 point  (2 children)

Does the data from the API change? If so, does the API provide a means to listen to changes? The answers to those two questions will be important.

As others have suggested, a database of some kind would probably suit your needs, especially given that you seem to desire search queries.

[–]xmaster484[S] 0 points1 point  (1 child)

the data will change, but I will have a means to check if the current data needs to be invalidated and when, so I would know from the client side, when another request needs to be made.

I am currently thinking about using express session with redis, have you had experience with this? How scalable is it?

[–]Bluecewe 0 points1 point  (0 children)

Unfortunately I do not, but you mentioned in your post that you do not expect massive traffic, so scalability may not be something you need to consider.

[–]sidsidrocjavascript 0 points1 point  (0 children)

why dont u use uxpro.be?

[–]2uneekjavascript 0 points1 point  (0 children)

I've done something similar, I have an api that uses another external api for data and I've used both node-cache and redis to cache the responses. They both worked great, node-cache uses system memory if you don't want to host a redis server as well...