I was wondering what the difference is between the async and sync callback patterns for basicAuth in connect.js middelware.
I understand the nodejs is on a single threaded event loop, but the synch “callback” is a callback function, and is thus asynchronous. So I don’t understand what the difference is.
In both cases your callback is actually called synchronously by
basicAuth, but in the asynchronous case you call thefnparameter to your callback to deliver the result back tobasicAuthinstead of returning the result from your callback function.Like shown in the canonical example code from here.