public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/html;charset=utf-8");
        response.setStatus(HttpServletResponse.SC_OK);
        JSONObject result;
        Pattern p = Pattern.compile("/db/api/([\\w]+)/([\\w]+)/");
        Matcher m = p.matcher(request.getRequestURI());
        try{
            if(request.getRequestURI().equals("/db/api/clear")){
                api.truncate();
            }
            else {
                if (!m.matches()) {
                    response.getWriter().println(badRequest("invalid url").toString());
                    return;
                }
                String entity = m.group(1);
                String method = m.group(2);

                Map<String,String[]> map = request.getParameterMap();
                Map<String,String> arguments = new HashMap<>();
                for (String key : map.keySet()) {
                    String value = map.get(key)[0];
                    arguments.put(key, parseAray(value));
                }

                System.out.println("////");
                System.out.println(entity+" | "+method);
                for(String arg : arguments.values())
                    System.out.println(arg);

                result = api.handleApiRequest(entity, method, arguments);

                if(result != null) {
                    System.out.println("\\\\");
                    System.out.println(result.toString());
                    response.getWriter().println(makeUnicodeCharactersEscaped(result.toString()));
                }
                else
                    response.getWriter().println(badRequest("api error"));
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }