Coder Social home page Coder Social logo

card-game-api's Introduction

card-game-api

An API to handle decks and cards to be used in any card game.

Install dependencies

To install all necessary dependencies for this application, execute:

npm install

To only install resolved dependencies in package-lock.json, execute:

npm ci

Run the application

You can run the application inside a Docker container or directly in the host environment.

With Docker

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 application
  • npm run docker:run: Run this application inside a Docker container

Without Docker

To run in the host, execute:

npm start

You can also run node . to skip the build step.

API

The application serves an API at http://localhost:3000.

Documentation on Postman

The following methods are available.

Ping

GET /ping

To verify if the API is running.

Create a new Deck

POST /decks

Body:

{
    "deck_id": "62814f64-68dc-42ad-9321-1eea62a72e9e", // UUID v4
    "shuffled": false,
    "remaining": 52
}

Open a Deck

GET /decks/{deck_id}

Draw a card from a deck

A count parameter needs to be provided.

POST /decks/{deck_id}/drawn-cards?count=2

Other commands

Rebuild the project

To incrementally build the project:

npm run build

To force a full build by cleaning up cached artifacts:

npm run rebuild

Run the tests

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.