#How to organize modules for pages ?

18 messages · Page 1 of 1 (latest)

green veldt
#

For example, when generating pages with a templating language like EJS, how would you organize the modules to serve those pages ?
Would you make a module for each page category for example RootModule, ContactModule, AboutModule ?
Or would you make a PageModule that would serve every page ?

thick helm
#

A page is a View. Controllers serve views. I would apply the same logic for pages as for "response dtos", that is, keep them in the module that they come from.

green veldt
#

In the app.controller ?

#

I need a method in a controller that takes the post data and sends the email

thick helm
#

Submission of the form generates a POST request, so you should handle that in the controller. The form itself would be rendered by the template

green veldt
#

thanks but what module would you put that in ?

#

would you make a Contact module

#

or a Form module ?

#

or just put that in app

#

I'm trying to figure out what would be the appropriate way to organize it

#

the form has no associated entity so it's not straight forward to categorize in a module

quiet bridge
green veldt
#

thanks

#

@quiet bridge I was thinking that it's the landing page, the best place would be the app module

#

index page ~= root

#

in my mind atleast

#

(app controller)