Overview
This document provides a complete reference for the Node.js application deployed through the Jenkins CI/CD pipeline. The application is a simple Express.js web server that responds to HTTP requests.Application Source Code
index.js
The main application file that creates and configures the Express server.Code Breakdown
Import Express
Create Express Application
Define Route Handler
/) that sends a text response.
The request object containing information about the HTTP request.
The response object used to send data back to the client.
Start Server
The port number on which the server listens for incoming requests.
Endpoints
GET /
The root endpoint that returns a welcome message. Request:HTTP method for the endpoint.
The URL path for the endpoint (root path).
Content type of the response. Express automatically sets this when using
res.send() with a string.HTTP status code returned on successful request.
Testing the Endpoint
Using curl:Package Configuration
package.json
The package configuration file defines project metadata, dependencies, and scripts.Package Fields
The name of the application package.
The current version of the application following semantic versioning.
A brief description of the application (currently empty).
The entry point file for the application.
The license under which the application is distributed.
Scripts
The test script executed when running
npm test. This is a dummy test that always succeeds (exit code 0).Dependencies
Express.js framework version 5.1.0 or higher (compatible with minor and patch updates). Used for building the web server.
Application Deployment
The application is deployed through the Jenkins pipeline using Docker.Local Development
Install dependencies:Docker Deployment
Build the Docker image:Port Configuration
The port on which the Express application listens inside the container.
The port exposed by the Docker container (defined in Dockerfile with
EXPOSE 3000).The port on the host machine mapped to the container port. The application is accessible on port 80 in production.
Testing
The application includes a dummy test script in package.json. Run tests:Environment
The application runs on Node.js version 18, using the Alpine Linux base image for minimal size.
The application uses Express.js version 5.1.0.
The working directory inside the Docker container where the application files are located.