Webapp actually does something

This commit is contained in:
greg 2017-10-02 00:15:39 -07:00
parent 9071846df3
commit 7430aebe63
1 changed files with 5 additions and 4 deletions

View File

@ -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() {