Skip to main content
In this guide, you’ll learn what Node.js is and how to set up, test, and run a simple “Hello World” application. We’ll also show you how to integrate this Node.js project into a custom GitHub Actions workflow for continuous integration.

What Is Node.js?

Node.js is an open-source, cross-platform JavaScript runtime built on Chrome’s V8 engine. It enables you to run JavaScript on the server side, unifying your front-end and back-end development in a single language. Installing Node.js also provides npm (Node Package Manager) for managing your dependencies.
  • High performance with non-blocking I/O
  • Vast ecosystem via npm
  • Single language for client and server

Prerequisites

Before you begin, ensure you have Node.js and npm installed on your machine.
Always verify that your CI/CD environment (like GitHub Actions) uses the same Node.js version as your local setup to avoid inconsistencies.

Sample Project Structure

Below is a minimal Node.js project that returns “Hello World” from a /hello endpoint.

Installing Dependencies

Install all required packages listed in package.json:
On success, npm generates a node_modules directory containing your project’s dependencies.

Running Your Tests

Run the test suite defined in test.js:
Expected output:

Starting the Application

Launch the server:
You’ll see:
In another terminal or your browser, request the /hello endpoint:

GitHub Actions Workflow

Automate your CI/CD pipeline by adding a workflow file at .github/workflows/ci.yml:

Watch Video