Skip to content

Latest commit

 

History

27 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flight Aggregator

The goal of the api is to get every flight to a destination and sort it by : - price, - departure date - travel time

exercices :

  • create a server (http.Server)
  • set 2 routes (http.ServeMux):
    • GET /health : to verify the healthiness of the server
      • set the status response to 200 : w.WriteHeader(http.StatusCreated)
    • GET /flight.
  • try to get the data of both apis from the server (client requests).
    • transform the data into structs (json.NewDecoder)
    • and organize the code to process the data in 2 repositories and extract the it using the same interface.
  • return the flights ordered by price
  • now you want to sort by price, time_travel or departure_date :
    • pass this information by query/params or body,
    • create the algorithms,
    • verify the output
  • Create tests for :
    • your sorting algorithms,
    • your flight service :
      • mock the repositories to make the tests.

to help you

pre-setup

  • install Docker Compose and start the project with: docker compose up
  • air is setup to auto reload the project on every modification !
  • a make file is here to run the tests with gotestsum :
    • install it with : go install gotest.tools/gotestsum@latest

Run the base project:

  • docker compose build
  • docker compose up

test

  • make test

access the apis :

startup :

  • use the Viper library Link Text,
  • get every env variables with : viper.AutomaticEnv()
  • then select with : viper.Get("MY_VAR")

tests :

notation

  • project structure :
    • controller, service, repo
    • interface
    • env variable handling

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages