import java.sql.*;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.Map;

import java.net.URI;
import java.net.URISyntaxException;

import static spark.Spark.*;
import spark.template.freemarker.FreeMarkerEngine;
import spark.ModelAndView;
import static spark.Spark.get;

import com.heroku.sdk.jdbc.DatabaseUrl;

public class Main {

    
  public static void main(String[] args) {

    port(Integer.valueOf(System.getenv("PORT")));
    staticFileLocation("/public");
    
    new UserController(new UserService());
    new UserControllerIntegrationTest();
	
     
   get("/topnav", (request, response) -> {
            Map<String, Object> attributes = new HashMap<>();
            attributes.put("user", "Summer");
            
            return new ModelAndView(attributes, "topnav.ftl");
        }, new FreeMarkerEngine());
  
    get("/calendar", (request, response) -> {
            Map<String, Object> attributes = new HashMap<>();
            attributes.put("user", "Summer");

            return new ModelAndView(attributes, "calendar.ftl");
        }, new FreeMarkerEngine());
    
    get("/guestcalendar", (request, response) -> {
            Map<String, Object> attributes = new HashMap<>();
            attributes.put("message", "This is a test");

            return new ModelAndView(attributes, "calendar.ftl");
        }, new FreeMarkerEngine());

    get("/db", (req, res) -> {
      Connection connection = null;
      Map<String, Object> attributes = new HashMap<>();
      try {
        connection = DatabaseUrl.extract().getConnection();

        Statement stmt = connection.createStatement();
        stmt.executeUpdate("CREATE TABLE IF NOT EXISTS ticks (tick timestamp)");
        stmt.executeUpdate("INSERT INTO ticks VALUES (now())");
        ResultSet rs = stmt.executeQuery("SELECT tick FROM ticks");

        ArrayList<String> output = new ArrayList<String>();
        while (rs.next()) {
          output.add( "Read from DB: " + rs.getTimestamp("tick"));
        }

        attributes.put("results", output);
        return new ModelAndView(attributes, "db.ftl");
      } catch (Exception e) {
        attributes.put("message", "There was an error: " + e);
        return new ModelAndView(attributes, "error.ftl");
      } finally {
        if (connection != null) try{connection.close();} catch(SQLException e){}
      }
    }, new FreeMarkerEngine());

  }

}

@@ -284,16 +284,54 @@
 ark.get;
+%0A        %0Aimport com.google.gson.Gson;
 %0A%0Aimport
@@ -576,44 +576,339 @@
     
-new UserControllerIntegrationTest();
+%0A    Gson gson = new Gson();%0A    %0A     get(%22/users/001%22, (req, res) -%3E %7B%0A            Map%3CString, Object%3E data = new HashMap%3C%3E();%0A            data.put(%22id%22, %22001%22);%0A            data.put(%22name%22, %22Summer Sanchez%22);%0A            data.put(%22email%22, %22summer@rickandmorty.com%22 );%0A            return data;%0A        %7D, gson::toJson);%0A%0A        
 %0A%09%0A 

test json file