@Override
	public Response serve(IHTTPSession request) {
		String uri = request.getUri();

		// handle favicon.ico
		if(uri.equals("/favicon.ico")) {
			return CommonResponses.showFavicon();
		}
		Session session = Session.fromNanoCookie(request.getCookies());
		String responseString = this.serveAsJson(request, session).toString();
		Response res = new Response(responseString);
		
		// write log
		this.logRequest(uri, responseString);
		
		res.addHeader("Set-Cookie", session.getCookieForResponse());
		res.addHeader("Access-Control-Allow-Origin", "*");
		return res;

	}