What confuses me is how websites like www.basketball-reference.com operate. Trawling through the network tab, I can't find any call to an API that loads the information on the frontend. Maybe this is the dumbest question alive (and please let me know if it is), but how do these websites disguise the payloads from their servers? Am I just not looking in the right place, is it encrypted and then decrypted somehow on the frontend, etc.
Ask HN: How do websites hide their APIs?
1–9 of 9 posts
Re: Ask HN: How do websites hide their APIs?
#2I guess my question is - what makes you think basketball reference uses a ton of api calls?
They do have some - search for example - but static sites and a mix of static sites and html works well for a lot of the web and can lower costs tremendously.
Re: Ask HN: How do websites hide their APIs?
#3They will most likely be rendering the page in full server-side. This is how things were done in the beginning, but also what a lot of websites are returning to, for performance reasons.
Re: Ask HN: How do websites hide their APIs?
#4It's not a stupid question at all. They will most likely be rendering the page in full server-side. This is how things were done in the beginning, but also what a lot of websites are returning to, for performance reasons.
Re: Ask HN: How do websites hide their APIs?
#5It's not a stupid question at all. They will most likely be rendering the page in full server-side. This is how things were done in the beginning, but also what a lot of websites are returning to, for performance reasons.
Gotcha, I think that makes sense! Just to make sure I understand -- on server-side, they're pulling in all relevant information from their own database and whatever 3rd parties are needed (maybe for injury reports, etc.). The server then generates an HTML page that it sends as-is to the client, which just faithfully renders the code? Thanks for the answer!
Re: Ask HN: How do websites hide their APIs?
#6It's not a stupid question at all. They will most likely be rendering the page in full server-side. This is how things were done in the beginning, but also what a lot of websites are returning to, for performance reasons.
Gotcha, I think that makes sense! Just to make sure I understand -- on server-side, they're pulling in all relevant information from their own database and whatever 3rd parties are needed (maybe for injury reports, etc.). The server then generates an HTML page that it sends as-is to the client, which just faithfully renders the code? Thanks for the answer!
Re: Ask HN: How do websites hide their APIs?
#7Here's an example of it in go - https://gowebexamples.com/templates/
Re: Ask HN: How do websites hide their APIs?
#8Re: Ask HN: How do websites hide their APIs?
#9I just wanted to add:
1. The words you're looking for is "server-side rendering".
2. After a decade or so of Angular, React etc, it seems people (not you, OP) have forgotten that HTTP can transfer things other than json, like plaintext, HTML etc. Whatever really.
3. You might want to read up on the OSI model. Just something to keep in mind. https://en.m.wikipedia.org/wiki/OSI_model