Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Web Development with MongoDB and Node.js
  • Table Of Contents Toc
Web Development with MongoDB and Node.js

Web Development with MongoDB and Node.js

By : Jason Krol
4 (12)
close
close
Web Development with MongoDB and Node.js

Web Development with MongoDB and Node.js

4 (12)
By: Jason Krol

Overview of this book

This book is designed for developers of any skill level that want to get up and running using Node.js and MongoDB to build full featured web applications. A basic understanding of JavaScript and HTML is the only requirement for this book.
Table of Contents (14 chapters)
close
close
12
12. Popular Node.js Web Frameworks
13
Index

Controllers

A controller is nothing more than an object that contains similar logic and functionality within our application. In our project, a controller is tied directly via its functions to a corresponding route. For every route that we create in our router, two parameters are necessary. The first parameter is the string for the route itself, that is /images/:image_id. The second parameter is a controller function that will be executed when that route is accessed. For 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 a personal preference. We created our controllers as modules so that our router wasn't a big, long convoluted mess of spaghetti code! We could have just as easily kept all of the logic contained in our controllers as functions directly within...

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Web Development with MongoDB and Node.js
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon