Open allthesignals opened 5 years ago
One thought is that if the function is core to the route, it doesn't need to be pulled out into a utility necessarily. Just abstracted into a function. That can happen in the same file. Although in order to get the benefit of being able to directly test that function, we still need to figure out how to export it.
@julialucyhogan yeah, the approach you were talking about is also suggested in a post I found - cool!
Currently, all our routes are defined as such:
This makes it hard to mock dependencies that come through the function signature,
(req, res)
.If we extract that function into a separate export, we could test routes much more easily.
My issue is that I don't know the best organizational approach to this... ES6 modules allows you to export a default and anything else:
I'm not sure how I can do this with AMD:
@julialucyhogan @chriswhong @pichot any ideas?