简体   繁体   中英

How manage time consuming API Calls in NodeJS

I am using an API from TinyPng.com which helps in compressing images.

When a user uploads images, I make an API call to TinyPng.com with the URL of the image that I want to compress, it provides a response with a link of the compressed file. Based on image size it could take about a few seconds to get a response.

How can I handle such time consuming processes in NodeJS ?

What you should be doing is handling that in the background on the server side. Once the compressed image is ready, download and replace the original one

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM