Tidying up the Interface
Discover how to simplify the user interface of your Elixir OTP server by creating essential functions like start_link, next_number, and increment_number. Learn to reduce complexity in server calls, improve code readability, and use module names for registered server processes. This lesson helps you build cleaner and more accessible server APIs.
We'll cover the following...
We'll cover the following...
As we saw, our server works but is complicated to use. Our callers have to make explicit GenServer calls, and they have to know the registered name for our server process. We can do better.
Major functions
Let’s wrap this interface in a set of three functions in our server module:
start_link