/echo-middleware-assessment

Junior Golang Developer assignment. Helps to understand how to implement middleware using echo.

Primary LanguageGo

Build echo middleware

Example project of test assessment from imaginary company.

  • Full text of the task can be found here
  • Video here

Task

You have 1 hour to solve the task. If you are lucky enough and have time left, please try to optimise your solution.

Build a middleware using echo framework

First of all, you should create a handler which sends how many days left until 1 Jan 2025 and response with HTTP 200 OK status code.

Secondly, build a middleware, which checks HTTP header User-Role presents and contains admin and prints red button user detected to the console (using default log package or any 3rd party) if so.

Run

go run github.com/spatecon/echo-middleware-assessment/cmd/umbrella-test-task

Test

curl --location --request GET '127.0.0.1:8080/status' \
--header 'User-Role: admin'

License

You can share the source code or use it in learning purposes.

Author

Ilia Pavliukov
i [at] ela.sh
2022