# Pono Hono-like web framework for Perl, built on PSGI and [Router::Boom](https://metacpan.org/pod/Router::Boom). ```perl use v5.36; use Pono; my $app = Pono->new; $app->get('/' => sub ($c) { $c->text('Hello Pono!'); }); $app->get('/hello/:name' => sub ($c) { $c->json({ hello => $c->req->param('name') }); }); $app->fire; ``` Experimental. ## Install ```sh cpanm Pono ``` ## API - Routing: `get` `post` `put` `delete` `patch` `options` `all` `on`. Paths take `:name` and `*` - Context `$c`: `text` `json` `html` `body` `redirect` `not_found` `header` `status` `set` `get` `req` `env` - Request `$c->req`: `param` `query` `header` `method` `path` `url` `body` `text` `json` `parse_body` - Middleware: `$app->use(sub ($c, $next) { ...; $next->(); ... })`, or with a path: `$app->use('/api/*' => sub ($c, $next) { ... })` - `$app->route('/api', $sub_app)`, `$app->not_found(sub ($c) { ... })`, `$app->on_error(sub ($error, $c) { ... })` - `$app->fire` returns the PSGI app (`to_app` is an alias) - `$app->request('/hello')` sends a request without a server, for tests The last handler of a route is called with `$c` only, so it can be written as `sub ($c) { ... }`. Handlers before it are called with `($c, $next)`. ## Development ```sh cpanm -L local --installdeps . prove -Ilib -Ilocal/lib/perl5 t/ plackup -Ilib -Ilocal/lib/perl5 eg/app.psgi ``` ## License MIT