After reading this article and this other one, I came to the conclusion that default export may not be the best approach. However, while trying to refactor my code, I encountered an issue with some variables/objects/functions that were not clearly defined for export. Here's an example:
import * as express from 'express';
import { Controller } from './controller';
const controller = new Controller();
express.Router()
.post('/', controller.create)
.get('/', controller.all)
.get('/:id', controller.byId);
export default express.Router();
I'm wondering how I can declare the export without using default export. I attempted:
export = express.Router
But I'm not sure if that's the best practice either. Any suggestions?