res.json();
}
this is synchronous, right??
in the scope of the function where you are doing this, yes
No. Using await cannot be done outside an async function. Even if you do only sync operations within an async functiom, it is still async
That I know Changed the code
It is actually synchronous. I suggest you take a look how the event loop works. In a nutshell, it sees the await keyword and passes that function to another thread, then continues the execution, when the function finishes executing and you have a result it sends a signal for the event loop to be called back to the main thread. Please correct me if I'm wrong
Обсуждают сегодня