plug_micropub/README.md

49 lines
876 B
Markdown
Raw Normal View History

2018-03-20 06:17:02 +01:00
# PlugMicropub
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 PlugMicropub,
handler: MyApp.MicropubHandler,
2018-04-12 07:08:37 +02:00
json_encoder: Poison
2018-03-20 06:17:02 +01:00
```
### Forwarding
If you want `PlugMicropub` to serve only a particular route, configure your router like:
#### Plug.Router
```elixir
forward "/micropub",
to: PlugMicropub,
init_opts: [
handler: MyApp.MicropubHandler,
json_encoder: Poison
2018-03-20 06:17:02 +01:00
]
```
#### Phoenix.Router
```elixir
forward "/micropub",
PlugMicropub,
handler: MyApp.MicropubHandler,
2018-04-12 07:08:37 +02:00
json_encoder: Poison
2018-03-20 06:17:02 +01:00
```
[1]: https://micropub.rocks/
[2]: https://github.com/bismark/micropub-example