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.
- Host: GitHub
- URL: https://github.com/yusukebe/hitagi
- Owner: yusukebe
- Created: 2010-03-20T20:38:01.000Z (over 16 years ago)
- Default Branch: master
- Last Pushed: 2010-03-24T07:33:23.000Z (over 16 years ago)
- Last Synced: 2025-04-19T08:15:08.438Z (about 1 year ago)
- Language: Perl
- Homepage:
- Size: 116 KB
- Stars: 20
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.mkdn
- Changelog: Changes
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