A quick and simple container-ized json-server for local frontend development and experiments
Try a built image from Docker Hub 🐳
docker build . -t <your-username>/json-server-container
Alternatively, pull a built image from Docker Hub:
docker pull lalugue/json-server-container
docker run -dp 3004:3004 <your-username>/json-server-container
If the image was pulled from Docker Hub, set <your-username>
as lalugue
instead
Afterwards, access/GET the sample route at port 3004; alternatively, open the following link in a web browser:
http://localhost:3004
For additional json-server
features and routes, please check the its readme: link
-
Adapted from the Node.js official guide: Dockerizing a Node.js web app
-
Random data generation snippet taken from
json-server
README (link) (MIT License)