Unit 2. Easier web development with Express.js

Unit 1 taught you how web servers work with Node.js and how to build meaningful content with built-in modules. This unit is about taking your application to a more robust and professional level by using a web framework and dynamic content. A web framework is a predefined application structure and a library of development tools designed to make building a web application easier and more consistent.

In this unit, you learn how to set up an application with Express.js and organize your application file structure to optimize communication of data among your pages. You’re also introduced to the model-view-controller (MVC) application architecture, which organizes your code into three distinct responsibilities:

  • Giving structure to your data
  • Displaying that data
  • Handling requests to interact with that data

With the goals of building on the lessons you learned in unit 1 and modifying your code to take full advantage of Express.js, this unit covers the following topics:

  • Lesson 8 introduces Express.js and shows how to configure a new Node.js application. In this lesson, you get an overview of how a web framework helps you develop an application.
  • Lesson 9 covers routing with Express.js. You’ve already learned about writing routes from scratch. This lesson introduces you to the style of routing you’ll use throughout the rest of the book. You also learn about MVC and see how routes can behave like controllers in that structure.
  • Lesson 10 introduces the concepts of layouts and dynamically rendered views. So far, you’ve worked only with static content, but in this lesson, you use Express.js to feed content to your views on every page reload. This lesson also discusses templating in Node.js. In Express.js, templating engines are at work to allow you to write placeholders for dynamic content into your HTML pages.
  • Lesson 11 builds on the preceding lessons to show how to handle application errors and configure a start-up script with npm.
  • Finally, lesson 12 shows how to rebuild your project from unit 1 by using Express.js. You re-create the three front-facing views for the cooking school’s website and add functionality to dynamically fill content from your application server.

This unit is your first step into web applications that may feel more familiar. Getting comfortable with Express.js and external packages will make you a more skilled developer. When your Node.js application is running successfully on Express.js, unit 3 talks about how to connect your app to a database and save user information.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.36.192