In this series of article we will detail out steps required for building node.js app, running this app inside a docker container and later deploying same in Google Kubernetes Engine. This article assumes you have a basics knowledge of JavaScript and YAML.

Prerequisite Software & Account

Verification command for installed Software

  • Node.js: node --version
  • Docker: docker --version
  • VSCode: code --version
  • Google Cloud SDK: gcloud --version

Execute above command in your command prompt and you should see version information related to software installed. If any of this command fails it means your software is not installed correctly / not registered in path variable (in windows). Please re-verify your installation.

Here is my dev environment version information

Dev environment details

OK now it is time for us to write a sample node.js app which will return "hello world" on http call. For quick setup of my node.js app I will be using npm init which will help me setting up my base package.json file required for sample application. Open a command prompt / cmder console, type npm init and press enter. You will be requested few inputs, based on your preference enter value required.

npm init setup

This should generate package.json file at your current location on command prompt. To return HTTP response with "Hello world" we will be using express.js. For including express.js npm package in our project execute following command in your command prompt / cmder

npm install express --save

This should add express.js to our sample application. To make sure if we have express.js in our project, just check your package.json file. This should have new entry for express & version information.

As mentioned in npm init we will be using server.js has our main / starting, create a new file at project root with name server.js. Open server.js in your text editor / VScode and add following code

var express = require('express');
var app = express();

app.get('/', function(req, res){
   res.send("hello world");


We are all set to run our node.js app which return "hello world" at port 8080. In your command prompt / cmder just type npm start.

This should start node.js process with code available in server.js. Open browser of your choice and enter http://localhost:8080

Node.js App output.

In my next article we will see changes required to move and run node.js app inside our docker container.