I know that javascript is single threaded, meaning only one operation runs at a time. Now consider the following scenario:
Scenario 1: I have a nodejs/express server running on port 5000, it has an endpoint, say, /convert-image. This endpoint uploads a png file and uses some third party library to convert it to a jpg file. (the conversion can either be synchronous or asynchronous)
Now, If I make 2 parallel api request to this endpoint, will it still run one thread to convert the files for each request?
Scenario 2: I have a file cron.js, that executes a long-running task, say it takes 10 mins to complete the task. If I open two tabs in my terminal, and run the cron.js file in both tabs, will it still create a single thread?