This may seam as a stupid question, but can I remove the async function below since there are no await's? It is a part of a large code base that is in production, so I am wondering if there could be some weird side effects if I remove async?
(async function(){
'use strict';
const {appLogger, monitorLogger} = require('./functions/logger');
...
for (let i in p) {
p[i].Filename = i;
check(p[i]);
}
...
app.get('/example.json', (req, res) => {
res.send(JSON.stringify(checkStates, null, 4));
})
app.listen(port, () => {
appLogger.info(`Exposing http://localhost:${port}/example.json`);
})
})();
My only thought would be that the await wraps any returned value (that isn't a promise) in a promise. However, this is a self-calling function and from what you've shown us there is nothing returned and nothing expecting a return. So unless there's other code you haven't shown, yes you should be fine.
Yes in this case you could remove async.
nope you dont need async if you're not awaiting for any promises.