Highly experimental lightweight microframework built on top of Plug
- Add
ezmodex
to your list of dependencies inmix.exs
:
```elixir
def deps do
[{:ezmodex, "~> 0.4.0"}]
end
```
- Ensure
ezmodex
is started before your application:
```elixir
def application do
[applications: [:ezmodex]]
end
```
- Set the ezmodex configuration in your
config.exs
:
```elixir
config :ezmodex,
router: Demo.Router,
port: 1337
```
- Create a router file:
```elixir
defmodule Demo.Router do
use Ezmodex.Router
gets "/", Demo.Homepage
not_found Ezmodex.NotFound
end
```
- 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
```
- Start your app and PROFIT!