Pattern Matching and Parameter

As of 1.1.0, package:angel_framework has nice support for injecting values from HTTP headers, query string, and session/cookie values, as well as pattern-matching for request handlers.

These act as a clean shorthand for commonly-used functionality.

Here is a simple example of each of them in action:

app.get('/cookie', (@CookieValue('token') String jwt) {
    return jwt;

app.get('/header', (@Header('x-foo') String header) {
    return header;

app.get('/query', (@Query('q') String query) {
    return query;

app.get('/session', (@Session('foo') String foo) {
    return foo;

app.get('/match', (@Query('mode', match: 'pos') String mode) {
    return 'YES $mode';

app.get('/match', (@Query('mode', match: 'neg') String mode) {
    return 'NO $mode';

app.get('/match', (@Query('mode') String mode) {
    return 'DEFAULT $mode';

A simple parameter annotation to inject the value of a sent HTTP header. Throws a 400 if the header is absent.


Searches for the value of a query parameter.


Fetches a value from the session.


Gets the value of a cookie.


The base class driving the above matchers.


  • defaultValue

  • required

  • custom error message

Last updated