This is a simple health endpoint using NodeJS and Express
- NodeJS 18
- Docker
Add the environment variable file called .env
.
cp .env.example .env
Edit the file .env
adding the port number in the variable
PORT=3000
Then run:
npm install
This will install all the project dependencies.
To execute the application in a local environment
npm run start
or
node index.js
Build the image
docker build . -t simple-health-endpoint
Execute the container exposing the port 80 on the localhost
docker run -p 80:3000 -d simple-health-endpoint
curl http://localhost:3000/health
curl http://localhost/health
This must return an Ok
and a 200
HTTP code.