Skip to content

Instantly share code, notes, and snippets.

@avisagie
Created July 11, 2015 07:30
Show Gist options
  • Save avisagie/aceba5b022a2dc022197 to your computer and use it in GitHub Desktop.
Save avisagie/aceba5b022a2dc022197 to your computer and use it in GitHub Desktop.
package asv.tryspark;
import com.google.gson.Gson;
import static spark.Spark.*;
/**
* Created by albert on 2015/07/11.
*/
public class Main {
public static class Result {
public final String contents;
public Result(String contents) {
this.contents = contents;
}
}
public static void main(String[] args) {
Gson gson = new Gson();
get("/", "application/json", (req, res) -> {
return new Result("Hello world!");
}, gson::toJson);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment