Fetch Requests and Controller Actions: Connecting the Frontend to the Backend

Let’s make fetch happen. Why do we need it? What can we do with it? How is it related to controller actions?

Waverley Leung
The Startup

--

Photo by ThisisEngineering RAEng on Unsplash

Table of Contents

  1. Introduction
  2. Refresher on Fetch Requests
  3. Structuring the Request with Fetch
    3a. Bonus! Getting the user’s input from a form
  4. Handling the Request & Structuring the Response with Controller Action
  5. Handling the Response with .then
  6. Conclusion & Summary
  7. Want more? Other resources to check out!

Introduction 💻

What does it mean to be a full-stack developer? Well, according to W3Schools, it means: “a person who can develop both client and server software”.

While I do agree with their definition, I would add that full-stack developers are basically match-makers 🥰. On their own, the frontend and backend are independent and don’t necessarily care about each other. Thus, it is the full-stack developer’s responsibility to make that connection happen and “match them up”. In other words, I believe that full-stack developers are people who know how to send…

--

--

Waverley Leung
The Startup

“Be present. Be open. Be kind. But speak your mind.” 🌱 Passionate about tech, connecting with people, eating good food, and dancing to my heart’s content.