-
Book Overview & Buying
-
Table Of Contents
Web Development with MongoDB and NodeJS - Second Edition
By :
A controller can be defined as the entity that will be responsible for manipulating models and initiating the view render process with the data received from the corresponding models. In the code we have developed so far, we can see that the express router instance is used to tie functions to a corresponding route. These functions are nothing but controllers. For every route that we create in our router, two parameters are necessary:
/images/:image_idFor any route that has to do with images, we rely on the images controller. Likewise, any route that has to do with the home page relies on the home controller, and so on and so forth.
The steps we will take to define our controllers in our app are purely organizational and based on personal preference. We created our controllers as modules so that our router wasn't a...
Change the font size
Change margin width
Change background colour