Setting Up the Environment | Node & Express

Setting Up the Environment | Node & Express

16/09/2026

As I mentioned in the previous articles, I will work with Node and Express. I installed Node from the official website for Windows choosing the Windows Installer (.msi). After installation, it's already available in the VS Code terminal and doesn't require any additional configuration.

Node is just a program that allows you to run JavaScript code right in the OS terminal, but another benefit of using it is a large library of packages written by other users, which help you code easier and faster using ready-made solutions. For this purpose, Node uses npm (Node Package Manager).

Open the terminal and enter the following command, which will create a file called 'package.json':

npm init --yes


This file is like a project's passport which shows the name, version, entry point file, installed packages and a lot of other information. This command initialized my project.

The first package I will install will be Express, which is one of the most popular frameworks for building web applications, and is especially a good fit for MPAs.

npm install express


After this, a 'node_modules' folder and a 'package-lock.json' file have appeared. The first one contains all the installed packages' files, while the file fixes specific versions of them.

I created an entry point file manually and called it 'app.js', you can call it whatever you want, it's up to you. In 'package.json', change the 'main' attribute's value from 'index.js' to the newly created file's name:

{
  "name": "myblog",
  "version": "1.0.0",
  "description": "",
  "main": "app.js", <--------------
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "type": "commonjs",
  "dependencies": {
    "express": "^5.2.1"
  }
}


Links:

1. Node.js: https://nodejs.org

2. Library of Node Packages: https://www.npmjs.com/

3. Express Package Page: https://www.npmjs.com/package/express