README.md

# ExCouch

[![version](https://img.shields.io/hexpm/v/ex_couch)](https://hex.pm/packages/ex_couch)
[![build status](https://github.com/enseadaio/enseada/workflows/tests/badge.svg)](https://github.com/enseadaio/ex_couch/actions)
[![license](https://img.shields.io/github/license/enseadaio/ex_couch)](./LICENSE)

A pure Elixir client for CouchDB 2.

## Installation

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

```elixir
def deps do
  [
    {:ex_couch, "~> 0.1.0"}
  ]
end
```

## Quick start

The `ExCouch` module can be supervised. Start it as part of your application.
The `url` parameter is required, and should point to the base URL of your
CouchDB instance (e.g. `http://localhost:5984`).
`username` and `password` are optional for unauthenticated servers.

```elixir
defmodule MyApplication do
  use Application
  def start(_type, _args) do
    children = [
      {ExCouch, url: "http://localhost:5984", username: "couch", password: "couch"}
    ]
    
    opts = [strategy: :one_for_one, name: Enseada.Supervisor]
    Supervisor.start_link(children, opts)
  end
end
```

After being started, methods can be called to interact with the server.
```elixir
list = ExCouch.list_databases(limit: 10, skip: 5)

{:ok, "mydb"} = ExCouch.create_database("mydb")

if ExCouch.database_exists?("mydb") do
  {:ok, info} = ExCouch.get_database("mydb")
end
```

## Documentation

Documentation can be found at [https://hexdocs.pm/ex_couch](https://hexdocs.pm/ex_couch).