This content originally appeared on DEV Community and was authored by Adrian Matei
Project: Codever
Enclose the response in setTimeout
router.get('/', async (request, response) => {
const {page, limit} = PaginationQueryParamsHelper.getPageAndLimit(request);
const bookmarks = await PublicBookmarksService.getLatestPublicBookmarks(page, limit);
setTimeout((() => {
return response.send(bookmarks);
}), 2000)
});
Shared with ❤️ from Codever. Use 👉 copy to mine functionality to add it to your personal snippets collection.
This content originally appeared on DEV Community and was authored by Adrian Matei
Adrian Matei | Sciencx (2022-01-27T06:52:01+00:00) How to delay an http response in ExpressJS. Retrieved from https://www.scien.cx/2022/01/27/how-to-delay-an-http-response-in-expressjs/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.