Number Fourteen

I encase someone else’s bed with my sheets. I fill someone else’s closet and dresser with my clothes. I use pots, pans and dishes that have seen many other hands. Someone else’s choice of paintings…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Fetching from a Server

There is a common question among developers when the are building a new web app. Where should we fetch our data from? If we are calling an external API do we pull data on the backend or front-end. To explain it a little deeper imagine if this is our code.

javascript $(".review").on("click", function (event) { event.preventDefault() let id = $(this).data("id") fetch(`www.someurl.com/books/${id}.json`).then(res => res.json()) .then(data =>{console.log(data)} }} )

When the user loads the page and creates the dom (and clicks the button) only then does the Js fire; meaning whose computer just made that request the users. However, if we were to be fetching that external API on the back-end even though the user triggered the server to fetch but whose computer actually fetched the data the server.

This might be confusing but is important lesson to understand so even if doesn’t make sense don’t give up.

Signing off

Sim Greenbaum

Add a comment

Related posts:

What Type of Coach Do You Want to Become?

A coach guides people and shows them the path of achieving their dream or goal. Coaches are generally well-educated and highly experienced individuals in a certain niche, and they are willing to…

The News

A Daily News Briefing of Articles and Analyses as Curated by Wonks This Way

Being Bride to Christ

A beautiful and profound metaphor found in the Bible: the Bride of Christ. Throughout Scripture, this imagery is used to describe the intimate relationship between Jesus Christ, our Lord and Savior…