I'm creating a new project with node.js, express.js and typescript.
I decided to use absolute paths, but I'm not very satisfied, because when I import files, it doesn't recognize automatically index.ts files.
My folder structure:
|--routes
| |--index.ts
| |--user.routes.ts
|--models
| |--index.ts
| |--user.ts
|--controllers
| |--index.ts
| |--user.controller.ts
|--services
| |--index.ts
| |--user.services.ts
|--index.ts
And my imports are like:
import { mainRouter } from '@routes/index';
I wanted it like:
import { mainRouter } from '@routes';
I read something about it, and said that absolute paths treats every file as a folder, that's why it happens.
Is there a way to solve this?