Bootstrapping a Sample Node.js Project

Learn how to create a simple Node.js application which can then be deployed using CodePipeline.

Introduction

We can develop our applications using a variety of programming languages, one of which is Node.js. We will be looking at how to set up a Node.js project and prepare it for deployment using AWS CodePipeline. Express is a Node.js framework that simplifies the development of Node.js and has many built-in features. It can be installed using the node package manager npm using the command:

npm install express-generator -g

In this command, -g signifies the global flag.

A simple Node.js application can be generated via the command line using the express <appName> command where appName is the application name.

We can follow the steps below to create a Node.js application called sample_app:

  1. Use the command below to bootstrap the application.
express sample_app
  1. Navigate to the project folder using the command below:
cd sample_app
  1. Install all required packages by typing the command below:
npm install

Node.js project architecture

When we bootstrap a Node.js project, we have a directory structure containing some folders and files as shown in the SPA below. These are explained below:

Get hands-on with 1400+ tech skills courses.