瀏覽代碼

standardize on api_

master
Noelle 4 年之前
父節點
當前提交
f7ba5adc88
共有 1 個檔案被更改,包括 4 行新增4 行删除
  1. 4
    4
      src/main.rs

+ 4
- 4
src/main.rs 查看文件

@@ -72,8 +72,8 @@ fn handle_connection(mut stream: TcpStream) {
fn route(c: &str, mut r: &mut Response) {

let mut routes = vec![];
routes.push(Route::new("api/hi", hi));
routes.push(Route::new("api/bye", bye));
routes.push(Route::new("api/hi", api_hi));
routes.push(Route::new("api/bye", api_bye));

// println!("Asked to fetch {}", c);
//assert!(Path::new(c).exists());
@@ -130,12 +130,12 @@ fn api_none(_c: &&str, r: &mut Response) {
r.set_content("There is currently no API endpoint at that address.");
}

fn hi(_c: &&str, r: &mut Response) {
fn api_hi(_c: &&str, r: &mut Response) {
r.set_header("HTTP/1.1 200 OK\r\n\r\n");
r.set_content("Hello there!");
}

fn bye(_c: &&str, r: &mut Response) {
fn api_bye(_c: &&str, r: &mut Response) {
r.set_header("HTTP/1.1 200 OK\r\n\r\n");
r.set_content("Leaving so soon?");
}

Loading…
取消
儲存