Chapter 3. Creating and setting up a MEAN project

 

This chapter covers

  • Managing dependencies by using a package.json file
  • Creating and configuring Express projects
  • Setting up an MVC environment
  • Adding Twitter Bootstrap for layout
  • Publishing to a live URL and using Git and Heroku

Now we’re really ready to get underway, and in this chapter we’ll get going on building our application. Remember from chapters 1 and 2 that throughout this book we’re going to build an application called Loc8r. This is going to be a location-aware web application that will display listings near users and invite people to login and leave reviews.

In the MEAN stack Express is the Node web application framework. Together Node and Express underpin the entire stack, so let’s start here. In terms of building up the application architecture, figure 3.1 shows where we’ll be focusing in this chapter. We’ll be doing two things:

Figure 3.1. Creating the encapsulating Express application, and starting to set up the main Express application

3.1. A brief look at Express, Node, and npm

3.1.1. Defining packages with package.json

3.1.2. Installing Node dependencies with npm

3.2. Creating an Express project

3.2.1. Installing the pieces

3.2.2. Creating a project folder

3.2.3. Configuring an Express installation

3.2.4. Creating an Express project and trying it out

3.2.5. Restarting the application

3.3. Modifying Express for MVC

3.3.1. A bird’s eye view of MVC

3.3.2. Changing the folder structure

3.3.3. Using the new views and routes folders

3.3.4. Splitting controllers from routes

3.4. Import Bootstrap for quick, responsive layouts

3.4.1. Download Bootstrap and add it to the application

3.4.2. Using Bootstrap in the application