DEV Community

Discussion on: How to build your own React boilerplate

 
hjfitz profile image
Harry

I would not make a broad assumption that "Everyone's used to normal express" with that code snippet.

If you've set up express, you'll have used my example. Not some over-engineered promise wrapper.

If you're unfamiliar with express, their readme gives a very similar example, at the top. github.com/expressjs/express/blob/...

It is not testable
Setting up an app, like Express' readme states doesn't need to be. I'm confident that they test it.

Any dev inheriting a project should not be making assumptions
You are correct. But you also shouldn't be wrapping code in unnecessary promises.

If you think wrapping it in a promise harms maintainability
In this case, it does. A class for handling 3 lines of code is so unnecessary. The lines of .then() makes it more difficult to read. I'd actually suggest you took a class in writing maintainable code. I'm happy with the quality of my code, and my employers agree.