DEV Community

Jayavignesh R
Jayavignesh R

Posted on

How to Achieve Auto Complete faster in Angular via API

Hi, I am currently working on a side project, which uses Third Party API Data search with Autocomplete.

I have written the code in way that
(Text Input) - > Make REST call to MY Server with query Param -> Then My Spring application makes a Rest Template call with API Key and other param to Third Party application. -> On receiving the large JSON it will filter and then return the Array of Suggestion to Angular application.

But the autocomplete is not instantaneous and responsive. I cant call the third-party directly from UI.
Any suggestions on it.

Top comments (2)

Collapse
 
briancodes profile image
Brian

There's no way around calling your API first if the 3rd party API keys are secret. To speed things up you could:

  • cache your API responses server side e.g. redis
  • add caching client side with a service worker
  • use an Rxjs throttle and switchMap on the UI's requests
Collapse
 
jai555 profile image
Jayavignesh R

Thanks for the suggestion. I will give a try to implement this.

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay