Skip to content

raku-community-modules/Web-App-Ballet

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
t
 
 
 
 
 
 
 
 

Web::App::Ballet

Introduction

An extension to [Web::App](https://github.com/raku-community-modules/Web-App /) which adds an interface similar to Dancer or Bailador.

NOTE: I am reworking this module to be merged with Bailador. A lot of Bailador is duplicating the work done in the Web project, and so I have agreed to work with tadzik to merge these two projects together. I am currently adding any of Bailador's features that are missing, and will then work with tadzik to make any transition required to merge the projects.

Supported Transports

Technically, it can use any backend transport that Web::App supports, but there are only convenience wrappers provided for the following:

  • SCGI

    The fastest way to connect to a web server such as Apache or lighttpd. Type 'use-scgi' in your application to use this.

  • HTTP::Easy

    A standalone HTTP server, useful for testing your in-development apps. Type 'use-http' in your application to use this. This is the default choice if you don't specify another option.

Supported Template Engines

We are using [Web::Template](https://github.com/raku-community-modules/Web -Template/) as our template engine abstraction layer, and will support any engines that it has wrapper classes for. The currently supported libraries are:

  • Template6

    An engine inspired by Template Toolkit. Has many features. Type 'use-template6' in your application to use this engine. This is the default choice if you don't specify another option.

  • Flower::TAL

    An implementation of the TAL/METAL XML-based template languages from Zope. Type 'use-tal' in your application to use this engine.

  • Template::Mojo

    A template engine inspired by Perl's Mojo::Template. Type 'use-mojo' in your application to use this engine.

  • HTML::Template

    A template engine inspired by Perl's HTML::Template. Type 'use-html' in your application to use this engine.

Example Application Script

  use Web::App::Ballet;

  use-template6; ## We're explicitly setting the template engine.

  get '/' => sub ($c) {
    $c.content-type: 'text/plain';
    my $name = $c.get(:default<World>, 'name');
    $c.send("Hello $name"); ## Explicit context output specified.
  }

  get '/perl6' => 'http://perl6.org/'; ## A redirect statement.

  get '/hello/:name' => sub ($c) {
    my $name = $c.get(':name'); ## get the placeholder path.
    $c.send(template('hello', :$name)); ## Explicit template output.
  }

  get '/about' => sub ($c) {
    template 'about', :ver<1.0.0>; ## Implicit template output.
  }

  dance; ## Start the process.

TODO

  • Add testing ability once Web::App has testing support added.

Author

Timothy Totten -- supernovus on #raku

License

Artistic License 2.0

About

WWW::App::Ballet, yet another Dancer-like web framework

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages