diff --git a/routes.json b/routes.json index f6b9bdc..4d230a9 100644 --- a/routes.json +++ b/routes.json @@ -3,4 +3,4 @@ "/results": "static/html/results.html", "/archives": "static/html/archives.html", "/favicon.ico": "static/img/favicon.ico" -} \ No newline at end of file +} diff --git a/settings.json b/settings.json index 0670620..1cf14dd 100644 --- a/settings.json +++ b/settings.json @@ -1,4 +1,4 @@ { "database_url": "sqlite:vote.db", - "bind_address": "127.0.0.1:8000" -} \ No newline at end of file + "bind_address": "127.0.0.1:8080" +} diff --git a/src/main.rs b/src/main.rs index fca152b..996dfdd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -179,12 +179,12 @@ async fn get_votes(req: &Request, db: Arc>) -> Vec, db: Arc>) -> Result>, Error> { let path = req.uri().path(); if path != "/post" { - return Ok(Response::builder().status(StatusCode::BAD_REQUEST).body(Full::new(Bytes::from("Bad Request"))).unwrap()); + return Ok(Response::builder().status(StatusCode::BAD_REQUEST).body(Full::new(Bytes::from("Bad Request (Bad Route)"))).unwrap()); } let body = req.into_body().collect().await?; let data: Result = from_reader(body.aggregate().reader()); if data.is_err() { - return Ok(Response::builder().status(StatusCode::BAD_REQUEST).body(Full::new(Bytes::from("Bad Request"))).unwrap()); + return Ok(Response::builder().status(StatusCode::BAD_REQUEST).body(Full::new(Bytes::from("Bad Request (Bad Data)"))).unwrap()); } let vote = data.unwrap(); let timestamp: DateTime = DateTime::from(SystemTime::now()); @@ -233,7 +233,7 @@ async fn main() { let daemonize = Daemonize::new() .pid_file("/var/vote/server.pid") .chown_pid_file(true) - .working_directory(current_directory.to_str().unwrap()) + .working_directory(current_directory) .stdout(stdout) .stderr(stderr); match daemonize.start() {