§2.2.

Preparing your computer

Before starting, you should install Node.js, Git and Visual Studio Code on your computer. The software is free and open-source.

You can install the software manually, or use a package manager.

  • Node.js (https://nodejs.org/en/) is an interpreter that allows you to run JavaScript code on your computer or a server. You will use Node.js to write the logic of your web server.

  • Git (https://git-scm.com/) is a tool that you will use to share code changes and collaborate with a team.

  • Visual Studio Code (https://code.visualstudio.com/) is an editor that has excellent support for web development and internet programming. [1]

In addition, I encourage you to install the MongoDB and PostgreSQL database management systems: [2]

  • PostgreSQL (https://www.postgresql.org/) is an open-source SQL database management system. It is one option you may choose to store application data.

  • MongoDB (https://www.mongodb.com/) is a commercial document-oriented database management system with a free community edition. It is one option you may choose to store application data.

Package managers

You can get a better programming experience by installing your software using a package manager.

Mac
  1. Open your macOS terminal

  2. Install Homebrew (https://brew.sh) by entering the installation command into your macOS terminal

  3. Enter the following commands to access the MongoDB ‘tap’ and install the required software:

    $ brew tap mongodb/brew
    ...
    $ brew install node postgresql mongodb-community telnet
    ...
    $ brew cask install visual-studio-code
    ...
Ubuntu Linux (Ubuntu Desktop 20.04 LTS recommended)
  1. Open a terminal window

  2. Enter the following commands to update and upgrade your system, and then install Git, Node, Postgres and Visual Studio Code:

    $ sudo apt update
    ...
    $ sudo apt upgrade
    ...
    $ sudo apt install git npm postgresql
    ...
    $ curl -o code.deb -L http://go.microsoft.com/fwlink/?LinkID=760868
    ...
    $ sudo apt install ./code.deb
    ...
    $
  3. Follow the official instructions to install MongoDB on Ubuntu

Windows
  1. Install Visual Studio Code in Windows, using the installer provided on the Visual Studio Code website

  2. Enable Windows Subsystem for Linux (WSL) (WSL1 will work fine, but WSL2 has higher compatibility with Linux applications)

  3. Install Ubuntu 20.04 LTS (Windows Subsystem for Linux) from the Microsoft Store in Windows. After you “Get” the software in the store, the first time you “Launch” the software in the store, it will complete the installation and ask you to set up a username and password. [3]

  4. Open a WSL terminal window

  5. Update your system, then install Git, Node and Postgres:

    $ sudo apt update
    ...
    $ sudo apt upgrade
    ...
    $ sudo apt install git npm postgresql
    ...
    $
Warning
For Windows: Some exercises in this workbook make use of the MongoDB database management system. However, MongoDB does not support WSL1. You can sign up to a online MongoDB service with MongoDB Atlas for a free ‘start cluster’. Node.js code running in WSL1 can access the cluster over the internet.

Whether you have a PC or a Mac, I recommend using Linux (e.g., Ubuntu 20.04 LTS) for web application development. This recommendation is because most servers on ‘the cloud’ run Linux. It is very convenient to use the same operating system locally as you use remotely. In addition, it helps you learn more about Linux. You can set-up Linux on your computer in at least three ways:

  1. Using a virtual machine (such as VirtualBox or VMWare Workstation Player)

  2. Using Windows Subsystem for Linux on Windows. You may find Linux difficult at first, but it will gradually become familiar and comfortable to you.

  3. Setting up ‘dual boot’ so that you can start Linux as an option when your computer turns on

Virtual machines are the slowest option, but will cause you the least difficulty if you are new to Linux.


1. I recommend Visual Studio Code but you can use any editor. Some developers prefer to use Webstorm (https://www.jetbrains.com/webstorm/, free student license), Atom (https://atom.io/, free) or Sublime Text (https://www.sublimetext.com/, free trial).
2. Instead of installing this software, it is also possible to use use a cloud-based online database. However, these notes do not include instructions for that scenario.
3. This uses the Windows Subsystem for Linux to provide a full Linux that runs inside Windows. Many Windows developers find this to be a better experience than developing natively in Windows. However, you can still complete everything in this workbook by installing the windows versions of Git and NodeJS using the downloads on their respective home pages.