| @@ -0,0 +1,8 @@ | ||
| FROM tfb/rust:latest | ||
| COPY ./ ./ | ||
| RUN cargo clean | ||
| RUN RUSTFLAGS="-C target-cpu=native" cargo build --release | ||
| CMD ./target/release/hello |
| @@ -0,0 +1,7 @@ | ||
| FROM tfb/rust:latest | ||
| COPY ./ ./ | ||
| RUN cargo clean | ||
| RUN RUSTFLAGS="-C target-cpu=native" cargo build --release | ||
| CMD ./target/release/iron |
| @@ -0,0 +1,11 @@ | ||
| [package] | ||
| name = "may-minihttp" | ||
| version = "0.1.0" | ||
| authors = ["Xudong Huang <huangxu008@hotmail.com>"] | ||
| [dependencies] | ||
| num_cpus = "1.0" | ||
| serde = "1.0" | ||
| serde_json = "1.0" | ||
| may = { git = "https://github.com/Xudong-Huang/may" } | ||
| may_minihttp = { git = "https://github.com/Xudong-Huang/may_minihttp" } |
| @@ -0,0 +1,15 @@ | ||
| # [may-minihttp](https://github.com/Xudong-Huang/may_minihttp) web framework | ||
| ## Description | ||
| may-minihttp is a small, fast micro http framework based on [May](https://github.com/Xudong-Huang/may) | ||
| ## Test URLs | ||
| ### Test 1: JSON Encoding | ||
| http://localhost:8080/json | ||
| ### Test 2: Plaintext | ||
| http://localhost:8080/plaintext |
| @@ -0,0 +1,23 @@ | ||
| { | ||
| "framework": "may-minihttp", | ||
| "tests": [ | ||
| { | ||
| "default": { | ||
| "json_url": "/json", | ||
| "plaintext_url": "/plaintext", | ||
| "port": 8080, | ||
| "approach": "Realistic", | ||
| "classification": "Micro", | ||
| "database": "None", | ||
| "framework": "may-minihttp", | ||
| "language": "Rust", | ||
| "orm": "raw", | ||
| "platform": "Rust", | ||
| "webserver": "may-minihttp", | ||
| "os": "Linux", | ||
| "database_os": "Linux", | ||
| "display_name": "may-minihttp" | ||
| } | ||
| } | ||
| ] | ||
| } |
| @@ -0,0 +1,8 @@ | ||
| FROM tfb/rust:latest | ||
| COPY ./ ./ | ||
| RUN cargo clean | ||
| RUN RUSTFLAGS="-C target-cpu=native" cargo build --release | ||
| CMD ./target/release/may-minihttp |
| @@ -0,0 +1,40 @@ | ||
| extern crate may; | ||
| extern crate num_cpus; | ||
| #[macro_use] | ||
| extern crate serde_json; | ||
| extern crate may_minihttp; | ||
| use std::io; | ||
| use may_minihttp::{HttpServer, HttpService, Request, Response}; | ||
| struct Techempower; | ||
| impl HttpService for Techempower { | ||
| fn call(&self, req: Request) -> io::Result<Response> { | ||
| let mut resp = Response::new(); | ||
| // Bare-bones router | ||
| match req.path() { | ||
| "/json" => { | ||
| resp.header("Content-Type", "application/json"); | ||
| *resp.body_mut() = | ||
| serde_json::to_vec(&json!({"message": "Hello, World!"})).unwrap(); | ||
| } | ||
| "/plaintext" => { | ||
| resp.header("Content-Type", "text/plain") | ||
| .body("Hello, World!"); | ||
| } | ||
| _ => { | ||
| resp.status_code(404, "Not Found"); | ||
| } | ||
| } | ||
| Ok(resp) | ||
| } | ||
| } | ||
| fn main() { | ||
| may::config().set_io_workers(num_cpus::get()); | ||
| let server = HttpServer(Techempower).start("0.0.0.0:8080").unwrap(); | ||
| server.join().unwrap(); | ||
| } |
| @@ -0,0 +1,8 @@ | ||
| FROM tfb/rust:latest | ||
| COPY ./ ./ | ||
| RUN cargo clean | ||
| RUN RUSTFLAGS="-C target-cpu=native" cargo build --release | ||
| CMD ./target/release/nickel |
| @@ -0,0 +1,8 @@ | ||
| FROM tfb/rust:latest | ||
| COPY ./ ./ | ||
| RUN cargo clean | ||
| RUN RUSTFLAGS="-C target-cpu=native" cargo build --release | ||
| CMD ./target/release/rouille |
| @@ -0,0 +1,8 @@ | ||
| FROM tfb/rust:latest | ||
| COPY ./ ./ | ||
| RUN cargo clean | ||
| RUN RUSTFLAGS="-C target-cpu=native" cargo build --release | ||
| CMD ./target/release/tokio-minihttp |
| @@ -0,0 +1,3 @@ | ||
| FROM tfb/base:latest | ||
| RUN curl -sSL https://get.haskellstack.org/ | sh |
| @@ -0,0 +1,21 @@ | ||
| FROM tfb/nginx:latest | ||
| ENV NIM_VERSION="0.11.2" | ||
| ENV NIM_CSOURCES="6bf2282" | ||
| RUN wget https://github.com/nim-lang/Nim/archive/v$NIM_VERSION.tar.gz | ||
| RUN tar xvf v$NIM_VERSION.tar.gz | ||
| RUN mv Nim-$NIM_VERSION nim | ||
| RUN cd nim && \ | ||
| git clone git://github.com/nim-lang/csources.git && \ | ||
| cd csources && \ | ||
| git checkout $NIM_CSOURCES && \ | ||
| sh build.sh && \ | ||
| cd .. && \ | ||
| bin/nim c koch && \ | ||
| ./koch boot -d:release | ||
| ENV NIM_HOME=/nim | ||
| ENV PATH=${NIM_HOME}/bin:${PATH} |
| @@ -0,0 +1,12 @@ | ||
| FROM tfb/base:latest | ||
| ENV RUST_VERSION="1.24.1" | ||
| RUN wget https://static.rust-lang.org/dist/rust-${RUST_VERSION}-x86_64-unknown-linux-gnu.tar.gz | ||
| RUN tar xvf rust-${RUST_VERSION}-x86_64-unknown-linux-gnu.tar.gz | ||
| RUN cd rust-${RUST_VERSION}-x86_64-unknown-linux-gnu && \ | ||
| ./install.sh --prefix=/rust | ||
| ENV LD_LIBRARY_PATH=/rust/lib:${LD_LIBRARY_PATH} | ||
| ENV PATH=/rust/bin:${PATH} |
| @@ -0,0 +1,11 @@ | ||
| FROM tfb/nim:latest | ||
| ENV NIMBLE_VERSION="0.6.2" | ||
| RUN cd $NIM_HOME && \ | ||
| wget https://github.com/nim-lang/nimble/archive/v$NIMBLE_VERSION.tar.gz && \ | ||
| tar xvf v$NIMBLE_VERSION.tar.gz && \ | ||
| mv nimble-$NIMBLE_VERSION nimble && \ | ||
| cd nimble && \ | ||
| ../bin/nim c src/nimble && \ | ||
| mv src/nimble ../bin/ |