DEV Community

Discussion on: How I structure my REST APIs

Collapse
 
davidszabo97 profile image
Dávid Szabó

What's the reason of repeating the name of the module in the modules directory? For example you got modules/user/user.controller.ts, how about just modules/user/controller? I don't see the point of duplicating it. When you import it, it looks weird import UserController from './modules/user/user.controller'

Same question applies to the services. I don't like the idea of adding ".service" to the file names. I already know that I am in the services folder.

Anyway, I like to modular approach!

Collapse
 
larswaechter profile image
Lars Wächter

One advantage might be: It's easier to differentiate the files by the tab titles in your editor :)

Collapse
 
larswaechter profile image
Lars Wächter

Yeah, that's actually a good point. Thanks!