Chapter 4. Building a static site with Node and Express
This chapter covers
- Prototyping an application by building a static version
- Defining routes for application URLs
- Creating views in Express by using Pug and Bootstrap
- Using controllers in Express to tie routes to views
- Passing data from controllers to views
By the end of chapter 3, you should have had an Express application running, set up in an MVC way, with Bootstrap included to help with building page layouts. Your next step is building on this base, creating a static site that you can click through. This step is critical in putting together any site or application. Even if you’ve been given a design or some wireframes to work from, there’s no substitute for rapidly creating a realistic prototype that you can use in the browser. Something always comes to light in terms of layout or usability that you hadn’t noticed before. From this static prototype, you’ll take the data out from the views and put it into the controllers. By the end of this chapter, you’ll have intelligent views that can display data passed to them and controllers passing hardcoded data to the views.