Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Cover image for How to Build Frontend Apps 10x Faster
Requestly profile imageAnmol Baranwal
Anmol BaranwalSubscriber forRequestly

Posted on • Edited on

     

How to Build Frontend Apps 10x Faster

We have all been there when the backend isn't ready with APIs so the frontend developers manually hardcode the response.

It's time consuming and comes with a lot of indirect problems.

Today, we will explore how Requestly can help you build frontend applications at least 10x faster by reducing dependency on backend developers.

Let's jump in.

excited to try it


In a nutshell, we are covering these topics in detail.

  1. What is the usual workflow when APIs aren't available?
  2. How Requestly solve that problem with use cases.
  3. More things that Requestly can help you achieve.

Star Requestly ⭐


1. What is the usual workflow when APIs aren't available?

In most cases, there isn't an efficient way to implement a proper frontend without API logic.

We can mock an API using Mirage JS but it still won't solve the issue completely.

backend is not ready

Let's see what is the usual dev workflow for any frontend developer when there are no APIs ready yet.

⚡ Backend developers create API contracts, which define how the frontend can interact with the backend services. These contracts are shared in JSON format, detailing the expected request and response structures.

⚡ Frontend developers take these API contracts and hardcode the expected responses directly into their code (workaround). This is often done to allow for immediate development and testing of the UI without waiting for the backend to be fully implemented.

⚡ When frontend developers need to integrate the actual API or submit a pull request (a request to merge their code changes into the codebase), they have to remove the hardcoded responses. This is necessary to ensure that the code interacts with the live API rather than the static data.

⚡ If reviewers leave comments on the pull request, frontend developers may need to revert to the hardcoded responses to continue refining the UI based on the feedback, since the actual API might not be available or stable at that moment. It's a huge hassle for simple stuff.

⚡ Similarly, during API integration, if issues arise (for instance the API is not returning the expected data), developers may need to bring back the hardcoded responses to continue working on the UI without being blocked by backend issues.

⚡ Thisback-and-forth of removing and reintegratinghardcoded responses can lead to a disorganized codebase and is very time-consuming. Developers may spend a lot of time managing these changes rather than focusing on building features.

⚡ The reliance on hardcoded responses makes it very tough to test various edge cases. Developers have to repeatedly modify the hardcoded data to test different situations, which may lead to errors and inconsistencies.

 

✅ Instead of hardcoding responses, a simple solution for developers can be to use mock servers that simulate API responses. This allows for more dynamic testing and reduces the need to modify code repeatedly.

mock

Let's see how we can solve this problem in the next section!


2. How Requestly solves that problem including use cases.

If you've ever developed a website, you know that every app needs to make a call to the server to fetch its resources.

It can be API requests, scripts or anything else to render it on the webpage.

Requestly is an open source frontend development platform that helps developers test and debug their apps faster without needing multiple deployment cycles. It helps you to:

✅ Build features when backend API is not ready.

✅ Testing code changes in production without deployment cycles.

✅ Testing, Validating, Mocking API responses and many more.

frontend vs backend

 

🎯 How to install Requestly?

You candownload the desktop app or find it on your preferred browser including Chrome, Safari and Brave.

requestly

desktop version

the desktop version

 

As I discussed the hardcoding responses in the codebase, you no longer need to do it after setting up Requestly. With a mutual understanding of the backend and frontend, an API contract is decided and then defined on the Requestly dashboard for the desired API endpoint.

It serves the response in such a way that it's coming from the server to avoid making any changes in the codebase or any other complex configuration.

The teams can agree on the responses. It can be added to the Requestly dashboard which leads to proper progress on the same feature by both teams without any big problems!

 

There are many other use cases like Requestly can help avoid the risk of accidentally committing mock code. However, I will explore a single use case on how we can use it to update the response with production APIs.

Let's see how to change the response body of HTTP requests without making actual changes in the server content using the Requestly Response Rule.

First, let's create a new Rule to modify the response body of an HTTP request.

create new rule

create new rule

 

We will only look at modify response rule with different examples and cases.

Select the API response option

Select the API response option

 

You get various template options as well if you quickly want to get started.

various template options

 

🎯 Wikipedia quick peek update - Static Override.

We will explore how we can update the quick peek data with fixed data so that after hovering any word on Wikipedia will show the same response.

As usual, we are going with the REST API.

modify response rule with REST API

 

✅ Explanation.

-→Request: this will contain the main API endpoint URL that will be used along with options likecontains andequal.

-→Response status: This will be the status code sent with the response that will help you identify the log easily. You can select the status codes like3xx,4xx,5xx and many more depending on your case.

-→Response: We can use static response data or a dynamic request to add custom logic using code. In case of lengthy API calls or the need to manage multiple requests simultaneously, usingAsync/Await can be efficient. It's damn useful :)

 

We will useStatic Response in this example, which is another way of saying static override.

If you're not aware of what a quick peek is, it is shown whenever anyone hovers over a text to understand more. You would have noticed it on Wikipedia.

To get the API endpoint, just start searching on Wikipedia and filter the network requests to get the one responsible for a quick peek.

The API endpoint responsible is:en.wikipedia.org/api/rest_v1.

go search on Wikipedia

you can also use any other API endpoints

 

Set up the rule with an example response, I've just used a quick peek JSON response of Amazon grabbed from the network log. You can copy this response from thisgist on GitHub.

This should update the quick peek of any hovered word.

the rule to update the quick peek of any hovered word

As you can see, the rule is applied properly.

The rule is applied properly

 

Output.

updated json response of quick peek

I've hovered over Google but the json response is the one we used

 

updated json response of quick peek

I've hovered over Apple but the json response is the one we used

 

The best part is that Requestly provides its own network log where you can catch the requests and analyze so many other stuff.

requestly console

 

🎯 Amazon Search Suggestion - Dynamic Override.

Let's understand how we can update the response on the Amazon search suggestions by usingDynamic JavaScript in this example, which is another way of saying dynamic override.

To get the API endpoint, just start searching on Amazon and filter the network requests to get the one responsible for search suggestions.

The API endpoint we get is:https://completion.amazon.in/api/2017/suggestions.

api endpoint for amazon search suggestions

 

-→ 🎯 Logic 1.

We are using a rule to append a number of suggestions with the URL of the API in the first suggestion of the Amazon query. The query is defined below!

functionmodifyResponse(args){const{method,url,response,responseType,requestHeaders,requestData,responseJSON}=args;// Change response below depending upon request attributes received in argsres=responseJSONres.suggestions[0].value=res.suggestions[0].value+" -"+res.suggestions.length+" -"+urlreturnresponse;}
Enter fullscreen modeExit fullscreen mode

dynamic rule

Once the rule is implemented, a message will be clearly shown on the page that the rule has been applied. I did it with multiple rules and it clearly showed that those specific rules were being applied.

clear message that the rule is applied on the page

 

Output.

query as laptop

query as laptop gives response based on the rule

 

query as laptop Samsung

query as laptop samsung gives response based on the rule

 

-→ 🎯 Logic 2.

Change the above rule to just show the response including the length of suggestions in the 2nd suggestion without appending the URL.

res.suggestions[1].value=res.suggestions[1].value+" -"+responseJSON.suggestions.length;
Enter fullscreen modeExit fullscreen mode

logic 2

 

Output.

2nd suggestion is changed

2nd suggestion is changed

 

-→ 🎯 Logic 3.

Let's change the first suggestion entirely torequestly in the rule by using:

res.suggestions[0].value='requestly';
Enter fullscreen modeExit fullscreen mode

new rule to change the first suggestion

 

Output.

requestly is the first suggestion

requestly is the first suggestion

 

-→ 🎯 Simulating Error.

During testing, you often face a situation where you want to test your feature in case of an API Error because simulating some errors can be tricky on backends. Let's put the response code as400.

setting response code as 400

response code as 400

 

Due to the error, there are no search suggestions visible!

there are no search suggestions visible

 

You can read more on the official blog on how to useModify API Response Rule.

Or watch this video!


3. More brief on what Requestly can help you achieve.

You can lots of other stuff like:

-→ Testing scripts or APIs directly on staging/production sites by redirecting HTTP requests(API Calls/Files) from one environment to another.

redirect

 

-→ Modify headers or Inject custom scripts/styles on external web pages.

-→ Intercept, Modify, and Mock GraphQL Query by applying extra targeting on operation name and query data.

 

It's extremely useful for QA Software engineers or frontend teams. Let's see some of the exciting features:

✅ You can create a workspace to share rules, mocks, and sessions. Faster collaboration leads to solving problems quickly!

collaboration

 

✅ You can record sessions and it's automatically done whenever you test a rule from the dashboard.

sessions

 

✅ You can enable/disable rules from the dashboard.

disable or enable rules

 

✅ You can get free credits and buy a premium plan after doing some basic things like creating a rule.

free credits

 

✅ You can read thedocumentation on how they perform in comparison with competitive tools like Charles Proxy, Fiddler, Resource Override, ModHeader, HTTP Toolkit, Proxyman, Wireshark, Mockoon, BirdEatsBug and Jam.

comparison

 

You can follow thequickstart guide and readhow to guides which would answer most of your questions.

I also recommend watching this quick demo to get started with Requestly!


I think it's safe to say Requestly can help you build your frontend apps at least 10x faster. It's easy and efficient.

It's worth it and a lot of international teams already use it in their workflow.

Let me know if you've any questions or feedback.

Have a great day. Till next time!

You can check
my work atanmolbaranwal.com.
Thank you for reading! 🥰
twittergithublinkedin

"Write more, inspire more!"

Ending GIF waving goodbye

Top comments(18)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss
CollapseExpand
 
anmolbaranwal profile image
Anmol Baranwal
Technical writer (1M+ reads) • Open Source developer (200+ PRs) Everything about me at "https://anmolbaranwal.com"Email for collab
  • Email
  • Location
    India
  • Education
    Computer Science
  • Work
    Technical Writer - open to opportunities
  • Joined

Hi guys.. you can do the same with GraphQL endpoints as well.

I initially covered it, but the article was getting too long.. so I decided to remove that section. Maybe I will cover it in one of my future articles.

If you're looking for a site to test with, Medium supports GraphQL APIs so you can try it there.

Image description

By the way, some people might misunderstand "10x faster" referring to speed which is why I explained it in the opening paragraph.

Thanks for reading.
Let me know if you enjoyed this :)

CollapseExpand
 
andrewbaisden profile image
Andrew Baisden
Software Developer | Content Creator | AI, Tech, Programming
  • Location
    London, UK
  • Education
    Bachelor Degree Computer Science
  • Work
    Software Developer
  • Joined

Nice, another helpful tool worth adding to my productivity list 😋

CollapseExpand
 
anmolbaranwal profile image
Anmol Baranwal
Technical writer (1M+ reads) • Open Source developer (200+ PRs) Everything about me at "https://anmolbaranwal.com"Email for collab
  • Email
  • Location
    India
  • Education
    Computer Science
  • Work
    Technical Writer - open to opportunities
  • Joined

Whoa! Thanks for reading Andrew 🙌
A lot of teams are already using Requestly in their workflow. It's definitely worth it!

Image description

CollapseExpand
 
ezra_kiplangat_25a5d8a70f profile image
Ezra Kiplangat
Am a web developer
  • Joined

Amazing

CollapseExpand
 
st3adyp1ck profile image
Ilya Belous
Beginner JS coder with a passion for learning, mastering functions, DOM manipulation, and app dev.
  • Location
    New Jersey
  • Work
    Founder at Northstar Software Development
  • Joined

Great article! I’m officially 10x faster just from reading it! 🚀 If this keeps up, by the end of the week, I’ll be coding at light speed and bending space-time to deliver projects before they’re even started!

But seriously, these tips are golden—especially the part about simplifying workflows. If I can shave even half the time off my dev process, I’ll finally have time to tackle my real enemy: figuring out where that missing semi-colon went…

Cheers to faster, cleaner code! May our console.logs be few and our deployments be smooth!

CollapseExpand
 
derick1530 profile image
Derick Zihalirwa
Software developer, Blockchain enthusiast
  • Location
    Uganda,Kampala
  • Education
    Internation university of east Africa, bachelor of Science in computer science
  • Work
    Software engineer
  • Joined

reading the first paragraph... LOL

CollapseExpand
 
jitendrachoudhary profile image
Jitendra Choudhary
Full Stack Developer | Open Source | Technical Writer | Flame University
  • Email
  • Location
    India
  • Education
    Freshman @Flame University
  • Pronouns
    He/Him
  • Work
    Open for opportunities
  • Joined

Most recommended for productivity.

CollapseExpand
 
anmolbaranwal profile image
Anmol Baranwal
Technical writer (1M+ reads) • Open Source developer (200+ PRs) Everything about me at "https://anmolbaranwal.com"Email for collab
  • Email
  • Location
    India
  • Education
    Computer Science
  • Work
    Technical Writer - open to opportunities
  • Joined

Thanks for reading Jitendra. Appreciate your support!

CollapseExpand
 
exclusivdkpro profile image
Rambevha Dakalo
All things javascript!AngularReact
  • Location
    Johannesburg
  • Work
    Front end developer
  • Joined

Thanks for sharing this!

CollapseExpand
 
chandra_pantachhetri profile image
Chandra Panta Chhetri
I’m a software developer. I enjoy learning about technologies, as each offers a unique perspective to solving problems and challenges me. I find it rewarding to apply what I've learned.
  • Joined

Thank you! It seems Requestly has a better UI & is easier to use compared to what I've used in the past (Fiddler).

CollapseExpand
 
neurabot profile image
Neurabot
Longlife learner. Fall in love with oriented-programming C++/Python. Leading many projects in fields.
  • Location
    Cameroon
  • Pronouns
    He
  • Work
    CEO at valone
  • Joined

Interesting.

CollapseExpand
 
anmolbaranwal profile image
Anmol Baranwal
Technical writer (1M+ reads) • Open Source developer (200+ PRs) Everything about me at "https://anmolbaranwal.com"Email for collab
  • Email
  • Location
    India
  • Education
    Computer Science
  • Work
    Technical Writer - open to opportunities
  • Joined

Thank you for reading :)

CollapseExpand
 
mohamed_karim_2dddebb42bd profile image
mohamed karim
Mohamed Karin work at google as a developer i launch my first project firebase.I have been promised as part of a large communlty of professional developer from innovative starup to global business.
  • Location
    England United Kingdom
  • Joined

Thank for sharing

CollapseExpand
 
mroman7 profile image
Roman
I'm a web developer specializing in building (and occasionally designing) exceptional digital experiences. My main focused is to building accessible, great user experience applications.
  • Location
    Pakistan
  • Joined

Nice, and amazing post

CollapseExpand
 
anmolbaranwal profile image
Anmol Baranwal
Technical writer (1M+ reads) • Open Source developer (200+ PRs) Everything about me at "https://anmolbaranwal.com"Email for collab
  • Email
  • Location
    India
  • Education
    Computer Science
  • Work
    Technical Writer - open to opportunities
  • Joined

Thanks for reading Roman :)
I'm sure this will make the process easier for teams.

CollapseExpand
 
expressa profile image
Expressa
Expressa is your solution for rapidly designing and automating Emails and PDFs. Create, customize, and send mass content using CSV uploads or API with minimal effort and maximum efficiency.
  • Location
    Berlin, Deutschland
  • Joined

Good post!

Some comments may only be visible to logged-in visitors.Sign in to view all comments.

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

More fromRequestly

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp