Skip to content

Commit

Permalink
Document new static features
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Mar 10, 2018
1 parent 29fbc1c commit d8810bd
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion docs/reference/cro-http-router.md
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,8 @@ directory:
}

This form will never serve content outside of the base directory; a path that
tries to do `../` tricks shall not be able to escape.
tries to do `../` tricks shall not be able to escape. The base can also be
specified as an `IO::Path` object.

For either of these forms, if no file is found then a HTTP 404 response will
be served. If the path resolves to anything that is not a normal file (such as
Expand All @@ -600,6 +601,15 @@ argument.
}
}

To serve an index file when a directory is requested (so, for example, a
request to `content/foo/` would serve `downloads/foo/index.html`), pass the
`indexes` named argument, specifying the filenames that should be considered:

get -> 'content', *@path {
static 'static-data/content', @path,
:indexes<index.html index.htm>;
}

## Adding custom response body serializers

Custom body serializers implement the `Cro::BodySerializer` role. They can
Expand Down

0 comments on commit d8810bd

Please sign in to comment.