Refactoring in order to use express-resource