Class: Weft::Router

Inherits:
Sinatra::Base
  • Object
show all
Includes:
Actions, Errors, OOBIncludes, Streaming
Defined in:
lib/weft/router.rb,
lib/weft/router/errors.rb,
lib/weft/router/actions.rb,
lib/weft/router/streaming.rb,
lib/weft/router/oob_includes.rb

Overview

Rack middleware that auto-generates routes for Weft::Components.

GET routes render components as HTML fragments (partial rendering). POST/PUT/DELETE/PATCH routes invoke component actions declared via performs or transfers, then render the action's target component.

Usage:

# Middleware (coexists with any Rack app)
use Weft::Router

# Standalone
run Weft::Router

Defined Under Namespace

Modules: Actions, Errors, OOBIncludes, Streaming