Code Monkey home page Code Monkey logo

live-score's Introduction

Live Score platform of St.Anthony's College Kandy

Run Locally

  • Clone your forked repository
    git clone https://github.com/USERNAME/live-score
    cd live-score
    
  • Set Username and a password as environment variables
    export LIVE_USERNAME=your_username
    export LIVE_PASSWORD=your_password
    
  • Build the project
    mvn install
    
  • Run the generated jar file
    java -jar target/livescore.jar
    
  • Visit your app at http://localhost:9090

API

Since this doesn't have a GUI you have to connect it using an API client.

Login to the platform

POST /login HTTP/1.1
Host: localhost:9090
Content-Type: application/json

{
    "username": "your_username",
    "password": "your_password"
}

Update scores

POST /update-test-match HTTP/1.1
Host: localhost:9090
Content-Type: application/json

{
    "status": "lorem ipsum",
    "teamOneFirstInning": {
        "score": 10,
        "overs": 2,
        "balls": 3,
        "wickets":3,
        "playerOne": {
            "name": "Kusal Mendis",
            "isBatting": true
        },
        "playerTwo": {
            "name": "Lasith Malinga",
            "isBatting": false
        },
        "currentInning": true
    },
    "teamTwoFirstInning": {
        "score": 10,
        "overs": 50,
        "balls": 0,
        "wickets":3,
        "playerOne": {
            "name": "Kusal Mendis",
            "isBatting": true
        },
        "playerTwo": {
            "name": "Lasith Malinga",
            "isBatting": false
        },
        "currentInning": false
    },
    "teamOneSecondInning": {
        "score": 0,
        "overs": 0,
        "balls": 0,
        "wickets":0,
        "playerOne": {
            "name": "",
            "isBatting": true
        },
        "playerTwo": {
            "name": "",
            "isBatting": false
        },
        "currentInning": false
    },
    "teamTwoSecondInning": {
        "score": 0,
        "overs": 0,
        "balls": 0,
        "wickets":0,
        "playerOne": {
            "name": "",
            "isBatting": true
        },
        "playerTwo": {
            "name": "",
            "isBatting": false
        },
        "currentInning": false
    }
}

Connect to the WebSocket

A working demo can be found at src/main/resources/static/app.js

How to debug?

  • Run the generated jar file in debug mode.

    java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 -jar target/livescore.jar 
    
  • Connect it with your favorite IDE

    InteliJ
    • Choose Run > Edit Configurations from the menu bar.
    • Select the + mark in the upper lef corner to add a new configuration.
    • Choose Remote option.
    • Set port to 5005
    • Hit apply
    • Run the jenerated jar file in debug mode.
      java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 -jar target/livescore.jar 
      
    • Hit Debug icon or press ^ + D to start debugging.
  • Enjoy!

live-score's People

Contributors

jayasanka-sack avatar anjula-sack avatar gravewalker666 avatar

Watchers

James Cloos avatar

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.