First commit, hello world

This commit is contained in:
Timothy Warren 2019-03-26 16:00:35 -04:00
commit c6819acc8d
5 changed files with 1062 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/target
**/*.rs.bk

1001
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

17
Cargo.toml Normal file
View File

@ -0,0 +1,17 @@
[package]
name = "iron_camera_crud"
version = "0.1.0"
authors = ["Timothy J Warren <tim@timshomepage.net>"]
edition = "2018"
[dependencies]
bodyparser = "0.8.0"
diesel = "1.4.1"
handlebars = "1.1.0"
iron = "0.6.0"
juniper = "0.11.1"
logger = "0.4.0"
mime = "0.2.3"
router = "0.6.0"
staticfile = "0.5.0"
urlencoded = "0.6.0"

0
src/db.rs Normal file
View File

42
src/main.rs Normal file
View File

@ -0,0 +1,42 @@
#[macro_use]
extern crate mime;
use iron::prelude::*;
use iron::status;
use router::Router;
mod db;
fn init_router() -> Router {
let mut router = Router::new();
router.get("/", |_request: &mut Request| {
let mut response = Response::new();
response.set_mut(status::Ok);
response.set_mut(mime!(Text/Html; Charset=Utf8));
response.set_mut(r#"
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Rust web server</title>
</head>
<body>
<h1>Hello, world!</h1>
</body>
</html>
"#);
Ok(response)
}, "root");
router
}
fn main() {
let router = init_router();
Iron::new(router)
.http("localhost:8000")
.unwrap();
}