Skip to content

Commit

Permalink
Use CommonJs
Browse files Browse the repository at this point in the history
  • Loading branch information
Wathfea committed Sep 3, 2024
1 parent 082d16c commit 25a7d7b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
9 changes: 4 additions & 5 deletions components/home/home.controller.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class HomeController {
getHome = async (_, res) => {
async getHome(_, res) {
try {
return res.status(200).send('Welcome to the Pullit API');
} catch (error) {
Expand All @@ -10,11 +10,10 @@ class HomeController {
'stack': error.stack
});
} else {
return res.status(500).json({error: 'Internal Server Error'});
return res.status(500).json({ error: 'Internal Server Error' });
}
}
};

}
}

export default HomeController;
module.exports = HomeController;
3 changes: 1 addition & 2 deletions components/home/home.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const HomeRouter = require('./home.router');
const homeController = new HomeController();
const homeRouter = new HomeRouter(homeController);

export default {
module.exports = {
router: homeRouter.router,
};

4 changes: 2 additions & 2 deletions components/home/home.router.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ class HomeRouter {

get router() {
const router = express.Router();
router.route('/').get(this.homeController.getHome);
router.route('/').get(this.homeController.getHome.bind(this.homeController));

return router;
}
}

export default HomeRouter;
module.exports = HomeRouter;

0 comments on commit 25a7d7b

Please sign in to comment.