Book Image

Web Development with MongoDB and Node.js

By : Jason Krol
Book Image

Web Development with MongoDB and Node.js

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)
12
12. Popular Node.js Web Frameworks
13
Index

Refactoring and improvements


At this point, the application that we've been building is pretty much complete! Before we iterate anymore on the project and continue to build it out and make it ready for production, we should probably consider some refactoring and/or general improvements. Some areas that I would personally take a look at to refactor and/or rewrite to improve the application's performance and overall sanity are as follows:

  • I might rethink working directly with Models so much within the controllers and instead create a utility that I can wrap a lot of that noise and rely on more basic CRUD calls to my Models and only providing a callback to each. This is most visible in the image controller with like, comment, and remove.

  • Validation! There is literally no validation in the project that we wrote and that's mostly for brevity. In reality, we should have included validation on any input fields a user interfaces with. Validation should be provided both on the frontend via jQuery or...