# Barracuda

Barracuda is to your http client what [Plug]( is to your web services.

For backend processing of HTTP requests we got [Plug](
There does not seem to be anything similar to write clients that access RESTful resources.
We have plenty of http clients but they all work in different ways and there is no simple
way of applying cross-cutting logic in a uniform manner to any/all of them.

Barracuda is a library that offers an easy way to generate RESTful clients for a service and easily apply cross-cutting logic.

defmodule Github do
  use Barracuda.Compiler, otp_app: :barracuda
  require Logger
  call :user_repos,
    path: "/users/{:username}/repos",
    verb: :get,
    required: [:username],
    required_headers: ["accept"],
    expect: 200


is github client that will fetch user's repositories and can be used as so:

Github.user_repos username: "ashneyderman"

this client needs additional configuration. Since client is part of :barracuda
application, config for it might look like this:

config :barracuda, Github,
  base_url: ""

## Installation

If [available in Hex](, the package can be installed as:

  1. Add `barracuda` to your list of dependencies in `mix.exs`:

    def deps do
      [{:barracuda, "~> 0.3.0"}]

  2. Ensure `barracuda` is started before your application:

    def application do
      [applications: [:barracuda]]
## Acknowledgements

The original idea and draft implementation is due to [Kevin Montuori](