Skip to content

davex98/nobl9-backend

Repository files navigation

example workflow

Table of Contents

Overview

This repository is a solution for a Golang Developer role in Nobl9.

It's an implementation of a service that gets random numbers from random.org and calculates standard deviation of the drawn integers and additionally standard deviation of sum of all sets.

Project Structure

  • api - OpenAPI definitions
  • docker - Dockerfiles, one for production (optimized one ~8Mb, running the application as nonroot) and one for development with live-reload
  • cypress/integration - e2e tests specification
  • random-generator - application code, it is written using clean architecture approach

Prerequisites

Make sure you have installed all of the following prerequisites on your development machine:

The applications requires setting up 2 environment variables (when running from docker image, they are set to default values):

  • PORT=8080
  • CONCURRENT_REQUESTS=5 - Limit of concurrent requests

As the provided date range in a single request might be broad, the random API should be queried concurrently. However, in order not to be recognized as a malicious user, a limit of concurrent requests to this external API must exist.

How to

Run app without building it

In order to run the service you can simply run:

make run_app_from_repository

It will automatically get the image from the repository and expose the port on 8080.

Run the development environment

In order to run the development environment, that enables the auto-reload so that we can see live changes, run:

make dev_env

Run the unit tests

In order to run the unit tests, run:

make unit_test

Reload the api specification

Once the api specification got changed in api/swagger.yml we need to update the code generated from that template. In order to do that, run:

make openapi

Run the end to end tests

In order to run the end-to-end tests using cypress, run:

make e2e_test

API specification

SwaggerHub

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published