[Gabriel Kolawole] # _

Recent Posts

Elixir Telegram Bot

published on
The quest was to develop a telegram bot over 24hrs, during an office hackathon event. I started out consulting documentation. Bot interaction was implemented as a GenServer named ConversationTree defmodule TelegramService.ConversationTree do use GenServer def start_link(name, conversation \\ %{message: [], response: [], tickets: []}) do {:ok, _} = GenServer.start_link(__MODULE__, conversation, name: name) name end def lookup(name) do GenServer.whereis(name) end def kill(name) do GenServer.stop(name) end def write_message(name, message = %{}) do GenServer. Read More...

Testing a phoenix controller

published on
The snippet below is a phoenix framework controller test defmodule PaymentServiceWeb.Controllers.PaymentTest do use ExUnit.Case, async: false use Plug.Test alias PaymentServiceWeb.Router @tag endpoint: true test "service health check" do conn = conn(:get, "/api") response = Router.call(conn, @opts) assert %Plug.Conn{resp_body: body} = response end end Explanation The test above is going to test an api endpoint, and the simple assertion is just to ensure that a %Plug.Conn struct is received as the response. Read More...

List of amazing elixir resource

published on
Here is an amazing list of handy libraries to use for elixir development. I have personally used the rsa_ex library which made the list in one of my projects. This can come handy in your next project. Share.

Categories

Ecto (1)

Elixir (7)

Tags

anonymous (1) bot (1) capture (1) controller (1) copy (1) database (1) ecto (2) elixir (8) fragments (1) genserver (1) graphql (1) libraries (1) mocking (1) operator (1) order_by (1) plug (1) query (1) recursion (1) resource (1) telegram (1) testing (2)