This is a simple Node.js application that provides a greeting page where users can enter their name and date of birth. Upon clicking the greeting button, the application calculates the user's age and displays a personalized greeting message.
greeting-app
├── src
│ ├── public
│ │ ├── css
│ │ │ └── style.css
│ │ ├── js
│ │ │ └── main.js
│ │ └── index.html
│ ├── server.js
│ └── routes
│ └── index.js
├── tests
│ └── unit
│ └── greeting.test.js
├── package.json
├── Dockerfile
├── .dockerignore
├── jest.config.js
└── README.md
- Node.js (version 14 or higher)
- npm (Node package manager)
-
Clone the repository:
git clone <repository-url> cd greeting-app
-
Install the dependencies:
npm install
To start the server, run the following command:
node src/server.js
The application will be available at http://localhost:3000
.
- Open your web browser and navigate to
http://localhost:3000
. - Enter your name and date of birth in the provided fields.
- Click the "Greet Me" button to see your personalized greeting.
The application uses Jest for testing. To run the tests, use the following command:
npm test
For running tests with coverage report:
npm run test:coverage
To build and run the application using Docker, follow these steps:
-
Build the Docker image:
docker build -t greeting-app .
-
Run the Docker container:
docker run -p 3000:3000 greeting-app
The application will be accessible at http://localhost:3000
in your web browser.
This project is licensed under the MIT License.