We need to be able to detect which kind of user is accessing our site. Based on the slides in the 002 episode we have 3 kinds of audiences. We need to put this concept into code. When request comes in we need to develop the plug that will detect our audience for us.
Basic Plug
We'll begin with the basic plug in the lib/botiful create a file called agent_plug.ex with the following content
defmodule Botiful.AgentPlug do
import Plug.Conn
require IEx
def init(options), do: options
def call(conn, _opts) do
IEx.pry
end
end
This is the most basic plug one can have we'll use this code to explore what is inside of the conn .