Automatic push from FunctionsAPI
This commit is contained in:
parent
db49f7182c
commit
1a1bf45136
3105
Cargo.lock
generated
Normal file
3105
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
11
Cargo.toml
Normal file
11
Cargo.toml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[package]
|
||||||
|
edition = "2021"
|
||||||
|
name = "web"
|
||||||
|
version = "0.1.0"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
openssl = { version = "0.10.35", features = ["vendored"] }
|
||||||
|
axum = "0.8"
|
||||||
|
pipeline-configuration = { git = "ssh://git@github.com/fathom-io/pipeline-calculations.git" }
|
||||||
|
serde_json = "1.0.138"
|
||||||
|
tokio = { version = "1.43.0", features = ["macros", "rt-multi-thread"] }
|
||||||
36
src/main.rs
Normal file
36
src/main.rs
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
use axum::http::HeaderMap;
|
||||||
|
use axum::{routing::post, Router};
|
||||||
|
use pipeline_configuration::pipeline_route::{PipelineRoute, Waypoint};
|
||||||
|
use std::net::SocketAddr;
|
||||||
|
use tokio::net::TcpListener;
|
||||||
|
|
||||||
|
async fn hello_world(headers: HeaderMap, body: String) -> String {
|
||||||
|
let env = std::env::vars().collect::<Vec<_>>();
|
||||||
|
let waypoints = vec![
|
||||||
|
Waypoint {
|
||||||
|
latitude: 52.16975830941925,
|
||||||
|
longitude: -104.1288528141576,
|
||||||
|
measure: 0.0,
|
||||||
|
elevation: 540.0,
|
||||||
|
},
|
||||||
|
Waypoint {
|
||||||
|
latitude: 52.20097892887157,
|
||||||
|
longitude: -104.0144102732867,
|
||||||
|
measure: 8563.471,
|
||||||
|
elevation: 540.0,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
let route = PipelineRoute::new(waypoints);
|
||||||
|
let start = route.location_of_measure(100.0).unwrap();
|
||||||
|
format!("Request headers: {headers:?}, request body: {body}, env: {env:?}, start: {start:?}")
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::main]
|
||||||
|
async fn main() {
|
||||||
|
let router = Router::new().route("/", post(hello_world));
|
||||||
|
|
||||||
|
let addr = SocketAddr::from(([0, 0, 0, 0], 8080));
|
||||||
|
let tcp = TcpListener::bind(&addr).await.unwrap();
|
||||||
|
println!("Ready and listening on {}", addr);
|
||||||
|
axum::serve(tcp, router).await.unwrap();
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user