package github.frodeaa.bottle;

import com.blade.Blade;
import com.blade.plugin.Plugin;
import github.frodeaa.blade.sql2o.Db;
import github.frodeaa.blade.sql2o.Sql2oPlugin;
import org.sql2o.Connection;


public class App {

    public static void main(String[] args) {
        Blade blade = Blade.me();

        blade.get("/", (req, resp) -> {
            resp.html("<h1>Hello Blade!</h1>");
        });

        blade.get("/health", (req, resp) -> {
            Integer status = Integer.valueOf(-1);
            Db db = blade.plugin(Db.class);
            try (Connection con = db.open()) {
                status = con.createQuery("select 0").executeAndFetch(Integer.class).get(0);
            }
            resp.json(status.toString());
        });

        ((Plugin) blade.plugin(Sql2oPlugin.class)).run();
        blade.start();
    }
}

@@ -25,16 +25,44 @@
 ottle;%0A%0A
+import blade.kit.json.Json;%0A
 import c
@@ -224,16 +224,108 @@
 ction;%0A%0A
+import static java.util.Collections.singletonMap;%0Aimport static blade.kit.json.Json.parse;%0A%0A
 %0Apublic 
@@ -613,10 +613,11 @@
 eOf(
--1
+500
 );%0A 
@@ -631,76 +631,59 @@
     
-Db db = blade.plugin(Db.class);%0A            try (Connection con = db
+try (Connection con = ((Db) blade.plugin(Db.class))
 .ope
@@ -738,16 +738,18 @@
 %22select 
+20
 0%22).exec
@@ -819,22 +819,53 @@
 sp.json(
-status
+parse(singletonMap(%22status%22, status))
 .toStrin

simplify use and return valid JSON