An open API service indexing awesome lists of open source software.

https://github.com/yusukebe/hitagi

Shall we talk about stars and micro web application frameworks.
https://github.com/yusukebe/hitagi

Last synced: 10 months ago
JSON representation

Shall we talk about stars and micro web application frameworks.

Awesome Lists containing this project

README

          

# Hitagi

> Shall we talk about stars and micro web application frameworks.

## SYNOPSIS

Write as

use Hitagi;
get '/' => sub { 'Hello' };
star;

Run it

$ perl myapp.pl

View at http://localhost:5000

## DESCRIPTION

Hitagi is yet another micro web application framework
using Plack::Request, Router::Simple, Text::MicroTemplate, and DBIx::Skinny.

### EXAMPLE

#### Using template in DATA section.

Template format is as Text::MicroTemplate.

use Hitagi;
get '/' => 'index';
star;

__DATA__

@@ index

welcome

#### Get params and give args to template

use Hitag;
get '/hi' => sub {
my ($req) = @_;
render( 'hi.mt',
{ message => $req->param('message') || 'no message' } );
};
star;

__DATA__

@@ hi

message : = $message ?>

#### Handle post request and parse params from url path

post '/comment/:id' => sub {
my ( $req, $args ) = @_;
warn "Comment id is : $args->{id}";
...;
};

#### Handle static files

Put your css or image files etc. to "static" directory.
You can access these files on http://localhost:5000/static/xxx.css

#### Make custom response such as XML

res method returns Plack::Response.

get '/xml' => sub {
my $res = res(200);
$res->content_type('application/xml');
$res->body( template('xml') );
$res->finalize;
};

...;

__DATA__

@xml
content

#### Template layout setting

use Hitagi;

...;

__DATA__
@@ index

welcome

@@ layout

title


= content ?>

This content is made by Hitagi