An API to handle decks and cards to be used in any card game.
To install all necessary dependencies for this application, execute:
npm install
To only install resolved dependencies in package-lock.json
, execute:
npm ci
You can run the application inside a Docker container or directly in the host environment.
To run inside a container (it needs the Docker properly installed on the environment), execute the following commands:
npm run docker:build
: Build a Docker image for this applicationnpm run docker:run
: Run this application inside a Docker container
To run in the host, execute:
npm start
You can also run node .
to skip the build step.
The application serves an API at http://localhost:3000.
The following methods are available.
GET /ping
To verify if the API is running.
POST /decks
Body:
{
"deck_id": "62814f64-68dc-42ad-9321-1eea62a72e9e", // UUID v4
"shuffled": false,
"remaining": 52
}
GET /decks/{deck_id}
A count
parameter needs to be provided.
POST /decks/{deck_id}/drawn-cards?count=2
To incrementally build the project:
npm run build
To force a full build by cleaning up cached artifacts:
npm run rebuild
To run the unit and acceptance (e2e) tests, execute the command:
npm test
This application was initially generated using LoopBack 4 CLI starting from the initial project layout.