Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/motemen/cirdan
Simple WAF on PSGI
https://github.com/motemen/cirdan
Last synced: 3 days ago
JSON representation
Simple WAF on PSGI
- Host: GitHub
- URL: https://github.com/motemen/cirdan
- Owner: motemen
- Created: 2009-12-18T20:08:45.000Z (about 15 years ago)
- Default Branch: master
- Last Pushed: 2010-01-20T04:44:36.000Z (about 15 years ago)
- Last Synced: 2024-11-30T21:27:10.718Z (2 months ago)
- Language: Perl
- Homepage:
- Size: 103 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Cirdan
======Chord の弱ぱくりです
Synopsis
--------
use Cirdan; # Exports routing functions, response functionsroutes {
POST q'/entry' => *post_entry; # Specify path as string, handler as typeglob
GET q'/entry/(\d+)' => *entry;
ANY q'/' => *index;
ANY qr// => sub { NOT_FOUND }; # Specify path as regexp, handler as coderef
};sub post_entry {
...
return BAD_REQUEST unless ...
...
redirect +Cirdan->router->path_for('index');
}use Cirdan::View qw(mt); # Exports renderer functions
sub index {
my $body = mt *DATA, @args;
return $body;
# or
# HTTP status code names are response maker
# such as CREATED([\@headers,] $content)
return OK $body;
return OK [ 'Content-Type' => 'text/xml' ], $body;
}# Finally...
__PSGI__ # returns PSGI handler__END__