Skip to content

Instantly share code, notes, and snippets.

@jayhuang75
Created September 20, 2022 12:09
Show Gist options
  • Save jayhuang75/19019d6e5c953ebb85a2bcb26c40a234 to your computer and use it in GitHub Desktop.
Save jayhuang75/19019d6e5c953ebb85a2bcb26c40a234 to your computer and use it in GitHub Desktop.
rust_serverless_trading_view_bootstrap
#[tokio::main]
async fn main() -> Result<(), Error> {
dotenv().ok();
// The runtime logging can be enabled here by initializing `tracing` with `tracing-subscriber`
// While `tracing` is used internally, `log` can be used as well if preferred.
tracing_subscriber::fmt()
.with_max_level(tracing::Level::INFO)
// disabling time is handy because CloudWatch will add the ingestion time.
.without_time()
.init();
let func = service_fn(func);
lambda_runtime::run(func).await?;
Ok(())
}
async fn func(_event: LambdaEvent<Value>) -> Result<Value, Error> {
// let (event, _context) = event.into_parts();
// let first_name = event["firstName"].as_str().unwrap_or("world");
// trigger the process
let mut new_proccessor = Proccessor::new().await.unwrap();
let count = new_proccessor.run().await.expect("process error");
Ok(json!({ "message": format!("process , {}!", count) }))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment