Web Development with MongoDB and Node.js
上QQ阅读APP看书,第一时间看更新

Chapter 1. Welcome to JavaScript in the Full Stack

What an exciting time to be a JavaScript developer! What was once only considered a language to add enhancements and widgets to a webpage has since evolved into its own full-fledged ecosystem. I believe Atwood's law says it best— any application that can be written in JavaScript, will eventually be written in JavaScript. While this quote dates back to 2007, it's never been more true than today. Not only can you use JavaScript to develop a complete single-page web application such as Gmail, but you will also see how we can achieve the following projects with JavaScript throughout the remaining part of the book:

  • How to completely power the backend using Node.js and Express.js
  • How to persist data with a powerful database like MongoDB
  • How to write dynamic HTML pages using Handlebars.js
  • How to deploy your entire project to the cloud using services like Heroku and AWS

With the introduction of Node.js, JavaScript has officially gone in a direction that was never even possible before. Now, you can use JavaScript on the server, and you can also use it to develop full-scale enterprise-level applications. When you combine this with the power of MongoDB and its JSON-powered data, you can work with JavaScript in every layer of your application.

One of the great advantages of developing with JavaScript in the "full stack" of a web application is that you are using a consistent language and syntax. Frameworks and libraries are no longer exclusive only to the frontend or backend but can be integrated into other layers of the application as well.

Underscore.js is an extremely popular JavaScript library to work with collections that is used equally on the backend with Node.js as much as on the frontend directly within the browser.

JavaScript in the full stack of a web application