GithubHelp home page GithubHelp logo

kentaro / p6-crust Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tokuhirom/p6-crust

0.0 2.0 0.0 249 KB

PSGI library stack for Perl6

License: Artistic License 2.0

Batchfile 0.02% Perl 6 98.95% Perl 1.03%

p6-crust's Introduction

Build Status

NAME

Crust - Perl6 Superglue for Web frameworks and Web Servers

DESCRIPTION

Crust is a set of tools for using the PSGI stack. It contains middleware components(TBI), and utilities for Web application frameworks. Crust is like Perl5's Plack, Ruby's Rack, Python's Paste for WSGI.

See PSGI for the PSGI specification.

MODULES AND UTILITIES

Crust::Handler

Crust::Handler and its subclasses contains adapters for web servers. We have adapters for the built-in standalone web server HTTP::Easy::PSGI, and HTTP::Server::Tiny included in the core Crust distribution.

See Crust::Handler when writing your own adapters.

Crust::Middleware

P6SGI middleware is a P6SGI application that wraps an existing P6SGI application and plays both side of application and servers. From the servers the wrapped code reference still looks like and behaves exactly the same as P6SGI applications.

Crust::Request, Crust::Response

Crust::Request gives you a nice wrapper API around PSGI $env hash to get headers, cookies and query parameters much like Apache::Request in mod_perl.

Crust::Response does the same to construct the response array reference.

.psgi6 files

A PSGI application is a code reference but it's not easy to pass code reference via the command line or configuration files, so Crust uses a convention that you need a file named "app.psgi6" or similar, which would be loaded (via perl6's core function "EVALFILE") to return the PSGI application code reference.

# Hello.psgi6
my $app = sub ($env) {
    # ...
    return $status, $headers, $body;
};

If you use a web framework, chances are that they provide a helper utility to automatically generate these ".psgi" files for you, such as:

# MyApp.psgi6
use MyApp;
my $app = sub { MyApp->run_psgi(@_) };

It's important that the return value of ".psgi" file is the code reference. See "eg/" directory for more examples of ".psgi" files.

AUTHORS

  • Tokuhiro Matsuno

  • mattn

  • Shoichi Kaji

  • Daisuke Maki

COPYRIGHT AND LICENSE

Copyright 2015 Tokuhiro Matsuno [email protected]

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.

p6-crust's People

Contributors

tokuhirom avatar moznion avatar lestrrat avatar mattn avatar skaji avatar fayland avatar softmoth avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.