Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I would create a DocumentRequest object that takes your req and res, then break apart your callbacks to separate functions on the DocumentRequest prototype. Then you would simply consume it with:

  app.get('/documents', new DocumentRequest);


Thanks for this. Been thinking about this. Could you recommend a book on patterns like these?




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: