Git Product home page Git Product logo

election's Introduction

Election

Sample project that uses Spring framework and demonstrates REST api.

Demonstrates

  • Spring REST api (GET, POST, PUT)
  • jpa repository
  • code coverage with jacoco
  • jenkins pipeline

Election Concepts

The following concepts will be used in this sample.

  • Voters - People who are registered to vote.
  • Poll - Pre-populated list of locations where voting takes place. Voters are allocated to a poll based on their postal code.
  • Candidates - What candidates can be voted for at a particular poll.
  • Parties - Group that candidates belong to.

Supported Operations

  • Add voters to the list of electors.
  • Retrieve a voters information (based on name).
  • Tell voters where they should vote.

Usage

To build the project do the following:

./gradlew clean build jacocoTestReport

To launch the application:

./gradlew bootRun

Test

Use curl to test the supported requests

Add a voter

$  curl -X POST http://localhost:8080/voters --header "Content-Type: application/json" --header "Accept: application/json" -d "{\"name\": \"Kirsteen\", \"postCode\": \"M2P 2H1\" }"
  {"id":"3","name":"Kirsteen","postCode":"M2P 2H1","poll":{"id":"1","name":"main","address":"3 main street","postcode":"M2P 2H1"}}

Retrieve a voter based on name

$ curl -X GET http://localhost:8080/voters?name=Kirsteen
[{"id":"3","name":"Kirsteen","postCode":"M2P 2H1"}]

Retrieve all voters

$ curl -X GET http://localhost:8080/voters
[{"id":"3","name":"Kirsteen","postCode":"M2P 2H1"},{"id":"4","name":"John","postCode":"M3C 0C1"}]

Future Considerations

  • Add candidates to the ballot using kafka [WIP]
  • Query what candidates are on the ballot at a particular location [WIP]
  • Dockerise
  • Add cucumber tests

election's People

Contributors

kirsteend avatar

Watchers

 avatar

election's Issues

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.