plug_indie/README.md
2024-11-29 10:42:27 +01:00

861 B

PlugIndie

A small library for helping build a Plug-based Micropub server.

A basic example server that implements all Micropub Rocks! validation tests can be found here.

Usage

Basic Usage:

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

forward "/micropub",
  to: PlugIndie,
  init_opts: [
    handler: MyApp.MicropubHandler,
    json_encoder: Poison
  ]

Phoenix.Router

forward "/micropub",
  PlugIndie,
  handler: MyApp.MicropubHandler,
  json_encoder: Poison