Code Monkey home page Code Monkey logo

iron-pack's People

Contributors

selaux avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

iron-pack's Issues

the trait `for<'r, 's, 't0> std::ops::Fn<(&'r mut iron::Request<'s, 't0>, iron::Response)>` is not implemented for `iron_pack::CompressionMiddleware`

My code:

extern crate env_logger;
extern crate iron;
extern crate iron_pack;
extern crate logger;
extern crate mount;
extern crate staticfile;

#[macro_use]
extern crate log;

use std::env;

use iron::prelude::*;
use logger::Logger;
use iron_pack::CompressionMiddleware;

fn main() {
    env_logger::init();

    info!("Initializing MobTag server...");

    let (logger_before, logger_after) = Logger::new(None);

    let mut chain = Chain::new(no_op_handler);

    chain.link_before(logger_before);

    // Static file serving
    let env_static_path: String;
    match env::var("MOBTAG_STATIC_PATH") {
        Ok(val) => {
            env_static_path = val;
            info!("Static files will be server from {:?}", env_static_path);
        }
        Err(e) => {
            error!(
                "Could not retrive the static file directory. The error returned was: {}",
                e
            );
            panic!();
        }
    }

    chain.link_after(CompressionMiddleware);
    chain.link_after(logger_after);

    info!("MobTag server listening on port 5000");
    Iron::new(chain).http("localhost:5000").unwrap();
}

fn no_op_handler(_: &mut Request) -> IronResult<Response> {
    Ok(Response::with((iron::status::Ok, "Hello World")))
}

I am pretty new to Rust and might be missing something obvious...

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.