Skip to content

Commit

Permalink
Update SmyBteApi.java
Browse files Browse the repository at this point in the history
  • Loading branch information
XboxBedrock authored Aug 4, 2023
1 parent 6fdf3ae commit e5428a4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/java/fr/thesmyler/smybteapi/SmyBteApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static fr.thesmyler.smybteapi.util.SmyBteApiUtil.getPropertyOrEnv;
import static fr.thesmyler.smybteapi.util.SmyBteApiUtil.touchJsonResponse;
import static spark.Spark.afterAfter;
import static spark.Spark.after;
import static spark.Spark.exception;
import static spark.Spark.get;
import static spark.Spark.internalServerError;
Expand All @@ -26,6 +27,7 @@
import fr.thesmyler.smybteapi.projection.ProjectionRoutes;
import spark.Request;
import spark.Response;
import spark.Filter;

/**
* Main class for this API
Expand Down Expand Up @@ -111,6 +113,10 @@ public static void setupSpark() {
get("/projection/toGeo", ProjectionRoutes::toGeo);
get("/projection/fromGeo", ProjectionRoutes::fromGeo);
get("/webmercator/resolution", OtherRoutes::mercatorRes);
after((Filter) (request, response) -> {
response.header("Access-Control-Allow-Origin", "*");
response.header("Access-Control-Allow-Methods", "*");
});
afterAfter(SmyBteApi::logRequestResponsePair);
}

Expand Down Expand Up @@ -144,4 +150,4 @@ public static String info(Request request, Response response) {
return GSON.toJson(json);
}

}
}

0 comments on commit e5428a4

Please sign in to comment.