Skip to content

Latest commit

 

History

History
29 lines (20 loc) · 679 Bytes

File metadata and controls

29 lines (20 loc) · 679 Bytes

EasyServer

Note: Saša Jurić has a much more complete library available: https://github.com/sasa1977/exactor

Tired of defining your handle_call or handle_cast functions as well as the client functions for issuing the GenServer.call and GenServer.cast? Look no further!

Add the library to your deps in mix.exs:

{:easy_server, "~> 0.0.1"}

Example usage

use EasyServer

cast(:push, state, element) do
    {:noreply, [element | state]}
end

call(:pop, [h | t], _from) do
    {:reply, h, t}
end

You can implement handle_info etc. as you normally would with GenServer. Check easy_server_test.exs for example usage.