This repository contains an example of a RESTful API which is developed in Node.js, using MongoDB and RESTHapi Gen. The main objective of this project is to have a microservice for testing cloud native tools, infrastructures, Node.js plugins and more.
See live demo
Node.js >= 12.x
git clone https://github.com/dani8art/pets.git
cd pets && npm i
npm start
It can be configured using some environment variable.
Option | Type | Description |
---|---|---|
MONGO_URL | string |
Optional The mongo URL to be used by mongoose. Default: mongodb://localhost:27017/pets . |
PETS_INITIAL_DATA | boolean |
Optional Whether an initial data should be loaded. Default: true . |
SERVER_ADDRESS | string |
Optional IP address where the server is attached. Default: 0.0.0.0 . |
SERVER_HOSTNAME | string |
Optional Hostname where the server is exposed, It is used to generate HATEOAS links. Default: localhost . |
SERVER_PORT | string |
Optional Port where the server is attached. Default: 4001 . |
docker run -d --name my-mongo mongo
docker run -d --name my-pets --link my-mongo:my-mongo -e MONGO_URL=mongodb://my-mongo/pets -p 4001:4001 darteaga/pets
curl -sSL https://raw.githubusercontent.com/dani8art/pets/master/docker-compose.yaml > docker-compose.yaml
docker-compose up -d
Pets API is MIT licensed.