Last active
February 28, 2023 21:12
-
-
Save afkvido/3e25e4018b49a31496f87f749030c1ae to your computer and use it in GitHub Desktop.
A simple method to allow all origins to access your Javalin server.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val app = Javalin.create().start(7070) | |
app.before { ctx -> | |
ctx.header("Access-Control-Allow-Origin", "*") // Allow CORS | |
} | |
app.get("/") { | |
ctx -> ctx.result("Hello World") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment