Please design and implement a web based API that steps through the Fibonacci sequence.
The API must expose 3 endpoints that can be called via HTTP requests:
current
- returns the current number in the sequencenext
- returns the next number in the sequenceprevious
- returns the previous number in the sequence
Example:
current -> 0
next -> 1
next -> 1
next -> 2
next -> 3
next -> 5
current -> 5
previous -> 3
previous -> 2
previous -> 1
previous -> 1
previous -> 0
Requirements:
- The API must be able to handle high throughput (~1k requests per second)
- The API should be able to recover and restart if it unexpectedly crashes
- The API should be able to handle integer overflows (for large Fibonacci numbers)
- You have the discretion to choose the approach (e.g., returning an error upon overflow, using a data type capable of handling large numbers, etc.)"
- Use Go and any framework of your choice for the backend
- The submission should be sent in a GitHub repo