Skip to content

Commit e8a56ea

Browse files
committed
examples do-rpc-server-client: Clean up.
1 parent 374979e commit e8a56ea

File tree

1 file changed

+0
-22
lines changed

1 file changed

+0
-22
lines changed

examples/do-rpc-server-client/src/server.rs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,4 @@ impl DurableObject for RPCServer {
2222
fn new(state: State, _env: Env) -> Self {
2323
Self { state, counter: 0 }
2424
}
25-
26-
// URL /{left}+{right}
27-
async fn fetch(&mut self, req: Request) -> Result<Response> {
28-
console_error_panic_hook::set_once();
29-
let url = req.url()?;
30-
let path = url.path();
31-
32-
let path = path.trim_start_matches('/');
33-
34-
let path_parts: Vec<&str> = path.split('+').collect();
35-
if path_parts.len() != 2 {
36-
return Response::error("Invalid URL", 400);
37-
}
38-
39-
if let (Ok(left), Ok(right)) = (path_parts[0].parse::<u32>(), path_parts[1].parse::<u32>())
40-
{
41-
let result = self.add(left, right);
42-
Response::ok(&format!("{} + {} = {}", left, right, result))
43-
} else {
44-
return Response::error("Invalid operands", 400);
45-
}
46-
}
4725
}

0 commit comments

Comments
 (0)