Webapp actually does something
This commit is contained in:
parent
9071846df3
commit
7430aebe63
@ -1,7 +1,8 @@
|
||||
use rocket;
|
||||
|
||||
use rocket::response::NamedFile;
|
||||
use rocket_contrib::Json;
|
||||
use schala_lang;
|
||||
use language::{ProgrammingLanguageInterface, EvalOptions};
|
||||
|
||||
#[get("/")]
|
||||
fn index() -> Result<NamedFile, ()> {
|
||||
@ -25,9 +26,9 @@ struct Output {
|
||||
|
||||
#[post("/input", format = "application/json", data = "<input>")]
|
||||
fn interpreter_input(input: Json<Input>) -> Json<Output> {
|
||||
println!("INPUT {:?}", input);
|
||||
let output = Output { text: "test interpreter output".to_string() };
|
||||
Json(output)
|
||||
let mut schala = schala_lang::Schala::new();
|
||||
let code_output = schala.evaluate_in_repl(&input.source, &EvalOptions::default());
|
||||
Json(Output { text: code_output.to_string() })
|
||||
}
|
||||
|
||||
pub fn web_main() {
|
||||
|
Loading…
Reference in New Issue
Block a user