- Building Enterprise JavaScript Applications
- Daniel Li
- 56字
- 2021-07-23 16:31:32
Modularizing our code
If you take a look inside the src/index.js file, you'll see that there are three top-level middleware functions—checkEmptyPayload, checkContentTypeIsSet, and checkContentTypeIsJson—as well as an anonymous error handler function. These are prime candidates that we can extract into their own modules. So, let's get started!