Code Monkey home page Code Monkey logo

slim4-rps-api's Introduction

Slim 4 RPS API

An API that implements the Rock-Paper-Scissors game written in Slim 4.

See Open API Specification.

Running the apps:

  1. Run composer

     $ composer install
    
  2. Run the migrations:

     $ touch db/rps.db
     $ vendor/bin/doctrine-migrations migrations:migrate
    
  3. Run the API

     $ php -d html_errors=0 -S 0.0.0.0:8888 -t public/
    

Useful curl commands

Create a game:

curl -i -H "Accept: application/json" -H "Content-Type: application/json" \
  http://localhost:8888/games -d '{"player1": "Rob", "player2": "Jon"}'

List games:

curl -i -H "Accept: application/json" http://localhost:8888/games

Make a move:

curl -i -H "Accept: application/json" -H "Content-Type: application/json" \
  -d '{"player": "Rob", "move": "rock"}' http://localhost:8888/games/f548aae6-3f4f-4c7f-a5fc-c0c1099411f7/moves

Example

Screenshot of Terminal showing curl playing the RPA game

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.