Struct nickel::Mount [] [src]

pub struct Mount<M> {
    // some fields omitted
}

Methods

impl<M> Mount<M>
[src]

fn new<S: Into<String>>(mount_point: S, middleware: M) -> Mount<M>

Creates a new middleware that mounts a middleware at a mount point. An incoming request that matches the mount point will be forwareded to the mounted middleware, but with the path rewritten so that the mount point appears to be the root from the perspective of the mounted middleware. This can be useful in combination with the StaticFilesMiddleware, for example.

Examples

use nickel::{Nickel, StaticFilesHandler, Mount};
let mut server = Nickel::new();

server.utilize(
    Mount::new("/static_files/",
               StaticFilesHandler::new("/path/to/serve/")
));

Panics

Panics if mount_point does not have a leading and trailing slash.

Trait Implementations

impl<D, M: Middleware<D>> Middleware<D> for Mount<M>
[src]

fn invoke<'mw, 'conn>(&'mw self, req: &mut Request<'mw, 'conn, D>, res: Response<'mw, D>) -> MiddlewareResult<'mw, D>