diff --git a/pom.xml b/pom.xml
index 4a965d7..03740e6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
2.0.7
0.4
2.0.7
- 3.4
+ 5.3
@@ -290,6 +290,13 @@
${skipTests}
+
+
+ com.cosium.code
+ google-java-format
+ 5.3
+
+
com.github.eirslett
diff --git a/src/main/java/config/Router.java b/src/main/java/config/Router.java
index 3ae71b7..2858292 100644
--- a/src/main/java/config/Router.java
+++ b/src/main/java/config/Router.java
@@ -46,6 +46,26 @@ public Router(Javalin app, PostService postService, UserService userService) {
public void setupRoutes() {
app.routes(
() -> {
+ // Activate CORS
+ app.options(
+ "/*",
+ ctx -> {
+ String accessControlRequestHeaders = ctx.header("Access-Control-Request-Headers");
+ if (accessControlRequestHeaders != null) {
+ ctx.header("Access-Control-Allow-Headers", accessControlRequestHeaders);
+ }
+
+ String accessControlRequestMethod = ctx.header("Access-Control-Request-Method");
+ if (accessControlRequestMethod != null) {
+ ctx.header("Access-Control-Allow-Methods", accessControlRequestMethod);
+ }
+ });
+ before(
+ "/*",
+ ctx -> {
+ ctx.header("Access-Control-Allow-Origin", "*");
+ ctx.header("Access-Control-Allow-Headers", "*");
+ });
get("/registrieren", userController::register);
post("/registrieren", userController::register);
@@ -78,28 +98,6 @@ public void setupRoutes() {
get("", ctx -> ctx.redirect("/docs/index.html"));
before("/*", ctx -> logger.debug("Received api call to path {}", ctx.path()));
- // Activate CORS
- app.options(
- "/*",
- ctx -> {
- String accessControlRequestHeaders =
- ctx.header("Access-Control-Request-Headers");
- if (accessControlRequestHeaders != null) {
- ctx.header("Access-Control-Allow-Headers", accessControlRequestHeaders);
- }
-
- String accessControlRequestMethod =
- ctx.header("Access-Control-Request-Method");
- if (accessControlRequestMethod != null) {
- ctx.header("Access-Control-Allow-Methods", accessControlRequestMethod);
- }
- });
- before(
- "/*",
- ctx -> {
- ctx.header("Access-Control-Allow-Origin", "*");
- ctx.header("Access-Control-Allow-Headers", "*");
- });
before("/*", this::checkCorrectRequestType);
before(
"/*",