Initial commit
This commit is contained in:
parent
aef92a4a31
commit
4d507e2f0f
2
shuttle/.gitignore
vendored
Normal file
2
shuttle/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/target
|
||||
Secrets*.toml
|
5151
shuttle/Cargo.lock
generated
Normal file
5151
shuttle/Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
11
shuttle/Cargo.toml
Normal file
11
shuttle/Cargo.toml
Normal file
@ -0,0 +1,11 @@
|
||||
[package]
|
||||
name = "jeffa"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
dust-lang = "0.1.1"
|
||||
rocket = "0.5.0-rc.2"
|
||||
shuttle-rocket = "0.25.0"
|
||||
shuttle-runtime = "0.25.0"
|
||||
tokio = "1.26.0"
|
24
shuttle/src/main.rs
Normal file
24
shuttle/src/main.rs
Normal file
@ -0,0 +1,24 @@
|
||||
use dust_lib;
|
||||
|
||||
#[macro_use]
|
||||
extern crate rocket;
|
||||
|
||||
#[get("/")]
|
||||
fn index() -> &'static str {
|
||||
"Hello, world!"
|
||||
}
|
||||
|
||||
#[get("/dust/<code>")]
|
||||
fn dust(code: &str) -> String {
|
||||
match dust_lib::eval(code) {
|
||||
Ok(result) => result.to_string(),
|
||||
Err(error) => error.to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
#[shuttle_runtime::main]
|
||||
async fn rocket() -> shuttle_rocket::ShuttleRocket {
|
||||
let rocket = rocket::build().mount("/", routes![index, dust]);
|
||||
|
||||
Ok(rocket.into())
|
||||
}
|
Loading…
Reference in New Issue
Block a user