/ezmodex

Ezmodex is a lightweight experimental Elixir microframework built on top of Plug

Primary LanguageElixir

Ezmodex

Highly experimental lightweight microframework built on top of Plug

Installation

  1. Add ezmodex to your list of dependencies in mix.exs:
```elixir
def deps do
  [{:ezmodex, "~> 0.4.0"}]
end
```
  1. Ensure ezmodex is started before your application:
```elixir
def application do
  [applications: [:ezmodex]]
end
```
  1. Set the ezmodex configuration in your config.exs:
```elixir
config :ezmodex,
  router: Demo.Router,
  port: 1337
```
  1. Create a router file:
```elixir
defmodule Demo.Router do
  use Ezmodex.Router

  gets "/", Demo.Homepage

  not_found Ezmodex.NotFound

end
```
  1. Create your page:
```elixir
defmodule Demo.Homepage do
  use Ezmodex.Page
  use Ezmodex.Elements

  view do
    html5 [
      head,
      body
    ]
  end

  partial head do
    head [
      title [ text("Homepage") ]
    ]
  end

  partial body do
    body [
      div [
        h1([ text("Ezmodex!") ]),
        p [
          text("More info at: "),
          a(%{ href: "http://github.com/efexen/ezmodex" }, [
            text("Ezmodex Github")
          ])
        ]
      ]
    ]
  end
end
```
  1. Start your app and PROFIT!

Everything is WIP