Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 139953

Block access to Express routes until route has finished

$
0
0

I have a route in my Express REST-API that does some db actions. I would like to block all other calls made to the REST-API until the actions in that route have finished.

So when this route is accessed no other routes can be accessed until update-db-state finishes.

router.put('/update-db-state', (req, res) => {
  ... does a buch of database related stuff.
});

Is there a way to do this?


Viewing all articles
Browse latest Browse all 139953

Trending Articles