Client Side vs Server Side When GET data from API

泄露秘密 提交于 2019-12-05 21:35:23

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.

Concerning hiding your API key, if you are using NodeJS, it doesn't matter whether you make calls from client side or server side, you have the control of not exposing your API key.

Concerning performance, I would propose to check out different opinions on the internet for the topic "Client Side VS Server Side rendering". There are a lot of articles related to performance. This is one them. Hope it helps.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!