An example on how to architect, test and develop with Odin.
We want a REST-API method to meet new friends but block annoying people.
The HTTP method is GET /hello/ and it will have three types of responses:
- If the person calls the REST-API method for the first time, then the REST-API will respond "Hello, nice to meet you "
- If the person calls the REST-API method for the second time, but after 60 seconds, then the method will respond with "Hello my friend"
- If the person calls the REST-API method repeatedly without waiting 60 seconds, then the method will respond with "Get away from me"
git clone https://github.com/laytan/odin-http
git clone https://github.com/rm4n0s/trace
odin build .
odin test . $> test.log
./hello_from
$ curl http://localhost:6969/hello/manos
Hello, nice to meet you manos
# after 60 seconds
$ curl http://localhost:6969/hello/manos
Hello my friend
# before 60 seconds
$ curl http://localhost:6969/hello/manos
Get away from me