This repository contains a RESTful API for managing person objects, built with Node.js and Express.js, and Dockerize for easy deployment and scalability.
Before you begin, make sure you have the following installed:
The following technologies were used to build this project:
- Node.js
- Express.js
- Docker
To run the application in a Docker container, follow these steps:
-
pull the repository: docker pull irenaeusxvi/restfull-api
-
Build the Docker image:
docker build . -t irenaeusxvi/restfull-api -f app/Dockerfile
-
Run the Docker container:
docker run -p 8000:8000 irenaeusxvi/restfull-api
The
-p
option maps the host port8000
to the container port8000
. This will start the API in a Docker container onhttp://localhost:8000
. -
Open a web browser and navigate to
http://localhost:8000/persons
to access the API.You should see a message indicating that the API is running.
-
For Stopping a container
**docker stop {Container name in your machine} **
The following API endpoints are available:
GET /api/persons
- get all personsGET /api/persons/{:id}
- get person by IDPOST /api/persons
- create a new personPUT /api/persons/{:id}
- update person by IDDELETE /api/persons/{:id}
- delete person by ID
http://localhost:8000/persons
http://localhost:8000/persons/{id}
http://localhost:8000/persons/{id}
http://localhost:8000/persons/{id}
Dockerize a simple RESTful API for managing person objects using Node.js and Express.js is a straightforward process. By following the steps outlined in this README.md file, you should be able to Dockerize this API and run it in a Docker container on your local machine.