package app;
/**
 * Created by Jiri Ketner on 17/06/16.
 */

import app.admin.AdminController;
import app.restaurant.RestaurantController;
import app.util.Path;
import com.mitchellbosecke.pebble.loader.ClasspathLoader;
import com.mitchellbosecke.pebble.loader.Loader;
import spark.ModelAndView;
import spark.template.pebble.PebbleTemplateEngine;

import static spark.Spark.*;

public class Application {

    public static void main(String[] args) {

        PebbleTemplateEngine engine = new PebbleTemplateEngine(getLoader());

        //-----------------------------
        // Configure Spark
        //-----------------------------

        port(4567);
        staticFiles.location("/public");
        staticFiles.expireTime(600L);

        //-----------------------------
        // Application Routes
        //-----------------------------

        // Web
        get(Path.Web.INDEX, RestaurantController.getAllRestaurants, engine);

        // Admin
        get(Path.Admin.INDEX, AdminController.index, engine);

        // Admin/uploaded-menu
        post(Path.Admin.UPLOADED_MENU, AdminController.uploadedMenu, engine);

        // Error
        get(Path.Web.ANYTHING, (req, resp) -> new ModelAndView(null, "404"), engine);

    }

    private static Loader getLoader() {
        Loader loader = new ClasspathLoader();
        loader.setPrefix("templates/");
        loader.setSuffix(".pebble");
        return loader;
    }

}


@@ -9,55 +9,8 @@
 app;
-%0A/**%0A * Created by Jiri Ketner on 17/06/16.%0A */
 %0A%0Aim
@@ -327,35 +327,302 @@
 *;%0A%0A
-public class Application %7B%0A
+/**%0A * Main Application class.%0A *%0A * @author Bc. Ji%C5%99%C3%AD Ketner%0A * @author Bc. David V%C4%9B%C5%BEn%C3%ADk%0A * @author Peter Neupauer%0A * @version 1.0%0A */%0Apublic class Application %7B%0A%0A    /**%0A     * Here it is where all routes are registered for application.%0A     *%0A     * @param args command line arguments%0A     */
 %0A   
@@ -1455,16 +1455,120 @@
 %0A    %7D%0A%0A
+    /**%0A     * Creates new instance of ClasspathLoader.%0A     *%0A     * @return class path loader%0A     */%0A
     priv

add comments to Application.java