title: Java, Spark, return index.html
body: <p>I'm trying to create SPA, using Spark on server-side.
  Here is my App.java:</p>
  
  <pre><code>package com.farot;
  import java.util.HashMap;
  import java.util.UUID;
  import java.net.URL;
  import java.net.URISyntaxException;
  import java.nio.file.Paths;
  import java.nio.file.Files;
  import java.nio.charset.Charset;
  import java.io.IOException;
  
  import com.google.gson.Gson;
  
  import static spark.Spark.*;
  
  import com.farot.utils.Path;
  
  import com.farot.controllers.UserController;
  import com.farot.controllers.AccountController;
  import com.farot.controllers.MapController;
  
  public class App 
  {
    private static Gson gson = new Gson();
  
    private static String renderIndex() {
      try {
        URL url = App.class.getResource("index.html");
        return new String(Files.readAllBytes(Paths.get(url.toURI())), Charset.defaultCharset());
      } catch (IOException | URISyntaxException e) {
        System.out.println(e.getMessage());
      }
      return null;
    }
  
    public static void main( String[] args )
    {
      staticFiles.location("/public");
  
      before((req, res) -&gt; {
        String path = req.pathInfo();
        if (path.endsWith("/"))
          res.redirect(path.substring(0, path.length() - 1));
      });
  
      // Site pages
      get("/", "text/html", (req, res) -&gt; renderIndex());
      get("/login", "text/html", (req, res) -&gt; renderIndex());
  
      post(Path.Web.api.Account.DEFAULT, (req, res) -&gt; { 
        return AccountController.create(req, res); 
      }, gson::toJson);
  
    }
  
  }
  </code></pre>
  
  <p>POST request at Path.Web.api.Account.DEFAULT works as expected, but request at /login returns 404. What can be wrong? 
  index.html's path is /resources/public/index.html.</p>