Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Client Side vs Server Side When GET data from API

I'm retrieving data from a movie API.

Now i can either do this in on client side (jQuery) or can make the http get call on the server side (Node.js).

Is there a best practice in doing this? Is one option faster than the other?

(I'm towards server side as I can hide my API key) but interested to know for certain.

like image 326
userMod2 Avatar asked Feb 28 '17 19:02

userMod2


1 Answers

Is there a best practice in doing this?

Not a general one

Is one option faster than the other?

Doing it server side allows results to be cached and shared between multiple clients. This might be faster.

Doing it server side allows the client to make one fewer HTTP requests. This might be faster.

Doing it client side allows it to be redone without reloading the whole page. This might be faster.

Doing it client side means it comes from a different computer which might be nearer or further from the server the request is being made to. This might be faster.

like image 114
Quentin Avatar answered Sep 20 '22 04:09

Quentin