Bier.RouterBuilder (bier v0.1.0)

Copy Markdown View Source

Builds the per-instance router module.

Unlike the legacy per-table approach, the router is now a thin catch-all: it forwards every request to Bier.Plugs.ActionController, which resolves the target {schema, relation} at request time from the path plus the Accept-Profile/Content-Profile headers. This is required to express PostgREST's schema selection (and /rpc/*) which a static route table cannot.

The generated module is named <instance_name>.Router and rebuilt on every boot, so it is not checked in.

Summary

Functions

Builds a Plug.Router module that dispatches everything to Bier.Plugs.ActionController, threading the instance name through assigns.

Functions

build(conf, db_structure)

@spec build(Bier.Config.t(), term()) :: {:module, atom(), binary(), any()}

Builds a Plug.Router module that dispatches everything to Bier.Plugs.ActionController, threading the instance name through assigns.