Synchronous code waits for an operation to finish. Asynchronous code allows other work to continue while an operation such as file or network I/O is in progress.
For web servers, asynchronous APIs are normally preferred because unnecessary blocking can reduce throughput.
Synchronous APIs can still be appropriate for small scripts or controlled startup tasks.
Deep dive
Choosing the right API
Use asynchronous APIs for normal server request processing. Synchronous APIs are easier to write but can pause the entire JavaScript execution flow while the operation completes.
Common mistake
Do not assume that using async/await automatically makes every operation non-blocking. An awaited database request is asynchronous, but a huge synchronous calculation inside an async function can still block the event loop.