48 lines
861 B
Markdown
48 lines
861 B
Markdown
# PlugIndie
|
|
|
|
A small library for helping build a Plug-based Micropub server.
|
|
|
|
A basic example server that implements all [Micropub Rocks!][1] validation
|
|
tests can be found [here][2].
|
|
|
|
## Usage
|
|
|
|
Basic Usage:
|
|
|
|
```elixir
|
|
plug Plug.Parsers,
|
|
parsers: [:urlencoded, :multipart, :json],
|
|
pass: ["*/*"],
|
|
json_decoder: Poison
|
|
|
|
plug PlugIndie,
|
|
handler: MyApp.MicropubHandler,
|
|
json_encoder: Poison
|
|
```
|
|
|
|
### Forwarding
|
|
|
|
If you want `PlugIndie` to serve only a particular route, configure your router like:
|
|
|
|
#### Plug.Router
|
|
|
|
```elixir
|
|
forward "/micropub",
|
|
to: PlugIndie,
|
|
init_opts: [
|
|
handler: MyApp.MicropubHandler,
|
|
json_encoder: Poison
|
|
]
|
|
```
|
|
|
|
#### Phoenix.Router
|
|
|
|
```elixir
|
|
forward "/micropub",
|
|
PlugIndie,
|
|
handler: MyApp.MicropubHandler,
|
|
json_encoder: Poison
|
|
```
|
|
|
|
[1]: https://micropub.rocks/
|
|
[2]: https://github.com/bismark/micropub-example
|