Message from JavaScript discussions

October 2020

— In the POST case


If you need to combine switch with break or return anyway, you might as well go for single if statements or function maps

— Wait, what?

— Where is the second time

— return res.end('OK') could solve it, right?

— Oh, yeah, missed that one ;)

— Yes, but avoid switches all together

— Use Misan's approach

— And you never have to think about any of these cases

— ALSO, if you define variables in your cases, you would also need blocks:
case 'POST': {
const foo = ...

Message permanent page

— Otherwise the variable declarations will "leak" to the other cases

— I use switches rarely so I forgot about all the things ;)