All Projects → garystafford → voter-service

garystafford / voter-service

Licence: Apache-2.0 license
The Voter Spring Boot RESTful Web Service, backed by MongoDB, and uses RabbitMQ for IPC

Programming Languages

java
68154 projects - #9 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to voter-service

Spring-Boot-2
Spring Boot 2.x examples
Stars: ✭ 33 (-37.74%)
Mutual labels:  rabbitmq, restful
core
WIP - A personal life helper providing solutions and happiness
Stars: ✭ 17 (-67.92%)
Mutual labels:  rabbitmq
koa-restful-boilerplate
A boilerplate for koa2 RESTful API development
Stars: ✭ 31 (-41.51%)
Mutual labels:  restful
microservices-v9
Learn Microservices with Spring Boot - v9
Stars: ✭ 40 (-24.53%)
Mutual labels:  rabbitmq
rabbitmq-rtopic-exchange
RabbitMQ Reverse Topic Exchange
Stars: ✭ 25 (-52.83%)
Mutual labels:  rabbitmq
o-fish-web
Web application for the Officer's Fishery Information Sharing Hub (O-FISH). The web app allows agencies to gain insights from the aggregated information gathered during a routine vessel inspection (submitted via the web app).
Stars: ✭ 29 (-45.28%)
Mutual labels:  mongodb-database
cottontail
Capture all RabbitMQ messages being sent through a broker.
Stars: ✭ 23 (-56.6%)
Mutual labels:  rabbitmq
WebApiWithBackgroundWorker
Small demo showing how to implement Pub/Sub with a BackgroundWorker in .NET Core
Stars: ✭ 55 (+3.77%)
Mutual labels:  rabbitmq
hellsnakebot
🤖About A fully customizable bot built with discord.js
Stars: ✭ 14 (-73.58%)
Mutual labels:  mongodb-database
fastql
⚙️ Full stack, Modern Web Application Generator. ✨ Using FastAPI, GraphQL, PostgreSQL as database, Docker, automatic HTTPS and more. 🔖
Stars: ✭ 80 (+50.94%)
Mutual labels:  rabbitmq
rabbitmq-jms-client
RabbitMQ JMS client
Stars: ✭ 51 (-3.77%)
Mutual labels:  rabbitmq
ml-ops
Get your MLOps (Level 1) platform started and going fast.
Stars: ✭ 81 (+52.83%)
Mutual labels:  rabbitmq
Online-Judge
Online Judge for hosting coding competitions inside NIT Durgapur made by GNU/Linux Users' Group!
Stars: ✭ 19 (-64.15%)
Mutual labels:  rabbitmq
lumen-boilerplate
Opinionated way to start a new Lumen project.
Stars: ✭ 20 (-62.26%)
Mutual labels:  restful
Go-gRPC-RabbitMQ-microservice
Go gRPC RabbitMQ email microservice
Stars: ✭ 107 (+101.89%)
Mutual labels:  rabbitmq
seal
django-base-templates 主要为 django 开发DEMO, 支持 非前后端分离 和 前后端分离模式 。
Stars: ✭ 118 (+122.64%)
Mutual labels:  restful
Carrot
Carrot is a .NET lightweight library that provides a couple of facilities over RabbitMQ.
Stars: ✭ 14 (-73.58%)
Mutual labels:  rabbitmq
Java-CS-Record
记录准备春招实习过程中,学习与复习的知识(模块化整理,非面试题速成)。注:暂停更新,后续请移步博客
Stars: ✭ 73 (+37.74%)
Mutual labels:  rabbitmq
spring-boot-crud-example
Spring Boot + MyBatis + Thymeleaf实现简单留言板应用
Stars: ✭ 17 (-67.92%)
Mutual labels:  restful
MinecraftNetwork
Minecraft server network backend
Stars: ✭ 35 (-33.96%)
Mutual labels:  rabbitmq

Build Status Dependencies Layers Version

Voter Service

Introduction

The Voter Spring Boot Service is a RESTful Web Service, backed by MongoDB, using Atlas on GCP, and RabbitMQ, using CloudAMQP on GCP. It is part of the Voter API (see diagram below). The Voter service exposes several HTTP API endpoints, listed below. API users can review a list candidates, submit a vote, view voting results, and inspect technical information about the running service.

Architecture

Voter Service Endpoints

The service uses a context path of /voter. All endpoints must be are prefixed with this sub-path.

Purpose Method Endpoint
List All Service Endpoints GET /voter/mappings
Create Vote POST /voter/voters
Read Vote GET /voter/voters/{id}
Read Votes GET /voter/voters
Update Vote PUT /voter/voters/{id}
Delete Vote DELETE /voter/voters/{id}
List Candidates GET /voter/candidates/{election}
View Voting Results GET /voter/results/{election}
View Total Votes GET /voter/results/{election}/votes
View Winner(s) GET /voter/winners/{election}
View Winning Vote Count GET /voter/winners/{election}/votes
Drop All Candidates POST /voter/drop/candidates
Drop All Votes POST /voter/drop/votes
Service Info GET /voter/info
Service Health GET /voter/health
Other Spring Actuator endpoints GET voter/actuator, voter/metrics, voter/env, voter/configprops, etc.
Other HATEOAS endpoints for /voter/votes Various page sort, size, etc.

The HAL Browser API browser for the hal+json media type is installed alongside the service. It can be accessed at http://localhost:8099/voter/actuator/.

Voting

Submitting a new candidate requires an HTTP POST request to the /voter/votes endpoint, as follows:

HTTPie

http POST http://localhost:8099/voter/votes \
  candidate="Jill Stein" \
  election="2016 Presidential Election"

cURL

curl -X POST \
  -H "Content-Type: application/json" \
  -d '{ "candidate": "Jill Stein", "election": "2016 Presidential Election" }' \
  "http://localhost:8099/voter/votes"

wget

wget --method POST \
  --header 'content-type: application/json' \
  --body-data '{ "candidate": "Jill Stein", "election": "2016 Presidential Election" }' \
  --no-verbose \
  --output-document - http://localhost:8099/voter/votes

Sample Output

API users can also create random voting data by calling the /voter/simulation endpoint. Using HTTPie command line HTTP client.

http http://localhost:8099/voter/simulation/2016%20Presidential%20Election
{
    "message": "Simulation data created!"
}
http http://localhost:8099/voter/candidates/db/2016%20Presidential%20Election
{
    "candidates": [
        {
            "election": "2016 Presidential Election",
            "fullName": "Darrell Castle",
            "politicalParty": "Constitution Party"
        },
        {
            "election": "2016 Presidential Election",
            "fullName": "Hillary Clinton",
            "politicalParty": "Democratic Party"
        },
        {
            "election": "2016 Presidential Election",
            "fullName": "Gary Johnson",
            "politicalParty": "Libertarian Party"
        }
    ]
}
http http://localhost:8099/voter/results/2016%20Presidential%20Election
{
    "results": [
        {
            "candidate": "Darrell Castle",
            "votes": 19
        },
        {
            "candidate": "Donald Trump",
            "votes": 15
        },
        {
            "candidate": "Gary Johnson",
            "votes": 15
        },
        {
            "candidate": "Jill Stein",
            "votes": 13
        }
    ]
}
http http://localhost:8099/voter/results/2016%20Presidential%20Election/votes
{
    "votes": 80
}
http http://localhost:8099/voter/winners/2016%20Presidential%20Election
{
    "results": [
        {
            "candidate": "Darrell Castle",
            "votes": 19
        }
    ]
}
http http://localhost:8099/voter/winners/2016%20Presidential%20Election/votes
{
    "votes": 19
}
http POST http://localhost:8099/voter/votes \
    candidate="Jill Stein" \
    election="2016 Presidential Election"
{
    "_links": {
        "self": {
            "href": "http://localhost:8099/voter/votes/590548541b8ebf700f9c2a62"
        },
        "candidate": {
            "href": "http://localhost:8099/voter/votes/590548541b8ebf700f9c2a62"
        }
    },
    "candidate": "Jill Stein",
    "election": "2016 Presidential Election"
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].