sheghun / containerized-webapp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Containerized WebApp

This is a short Go and Reactjs web app tom find the highest prime number of a given, this structure of this project is inspired by Golang Project Layout

A live version of this app is hosted on here on digital ocean

Design Decisions

I decided to go with a concurrency approach, utilising Golang's concurrency support I was able to break finding the highest prime number into batches of 10, i.e if an input 50 is supplied, the last 10 highest number of 50 that is 40-50 will be calculated for prime numbers if no prime number is found within this range the next 10 highest numbers 30-40 will be calculated and so on.

Using this approach we're taking advantage of Golang's multi-processing ability to solve this problem faster, when the highest prime number of a particular supplied number is found the highest prime number is indexed in redis database for an hour to make future retrievals a lot faster

Running

The app and its dependencies are managed by docker compose to run the app use the command below it uses docker-compose under the hood

$ make run

Visit http://localhost:8080 to view the app

Testing

$ cd __tests__
$ go test

About


Languages

Language:Go 43.1%Language:TypeScript 36.0%Language:HTML 14.5%Language:CSS 3.1%Language:Makefile 1.9%Language:Dockerfile 1.4%