Garrit Franke
3 years ago
3 changed files with 26 additions and 0 deletions
@ -0,0 +1,24 @@
|
||||
mod gempress; |
||||
|
||||
use gempress::{Gempress, Request, Response}; |
||||
use std::path::Path; |
||||
|
||||
pub fn handler(req: &Box<Request>, res: &mut Box<Response>) { |
||||
res.send("Hello World!\n"); |
||||
} |
||||
|
||||
fn main() { |
||||
// Run make_cert.sh to generate a certificate
|
||||
let config = Gempress::Config { |
||||
certPath: Path::new("../cert.pem"); |
||||
keyPath: Path::new("../key.pem"); |
||||
} |
||||
|
||||
let app = Gempress::new(config); |
||||
|
||||
app.on("/", handler); |
||||
|
||||
app.listen(1965, || { |
||||
println!("Listening on port 1965"); |
||||
}); |
||||
} |
Loading…
Reference in new issue