Skip to content

Commit

Permalink
Migrate steel-webserver
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRealLorenz committed Feb 10, 2024
1 parent 5b9e21d commit 4b45147
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions libs/steel-webserver/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ tokio = { version = "1.0", features = ["full"] }
crossbeam = "0.8.2"
serde_json = "1.0.92"
abi_stable = "0.11.1"
fxhash = "0.2.1"
7 changes: 4 additions & 3 deletions libs/steel-webserver/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use axum::{extract::Query, http::StatusCode, routing::get, Router};
use std::{collections::HashMap, net::SocketAddr};
use fxhash::FxHashMap;
use std::net::SocketAddr;
use steel::{
rvals::{Custom, SerializableSteelVal},
steel_vm::ffi::{FFIModule, FFIValue, IntoFFIVal, RegisterFFIFn},
Expand All @@ -20,7 +21,7 @@ struct Request {
typ: RequestType,
path: String,
body: Option<String>,
query_parameters: HashMap<String, String>,
query_parameters: FxHashMap<String, String>,
}

impl Custom for Request {}
Expand Down Expand Up @@ -208,7 +209,7 @@ fn spawn_server(
&route,
get(
|Path(path): Path<String>,
Query(params): Query<std::collections::HashMap<String, String>>,
Query(params): Query<FxHashMap<String, String>>,
body: Option<String>| async move {
let request = Request {
typ: RequestType::Get,
Expand Down

0 comments on commit 4b45147

Please sign in to comment.