Skip to content

Instantly share code, notes, and snippets.

@afkvido
Last active February 28, 2023 21:12
Show Gist options
  • Save afkvido/3e25e4018b49a31496f87f749030c1ae to your computer and use it in GitHub Desktop.
Save afkvido/3e25e4018b49a31496f87f749030c1ae to your computer and use it in GitHub Desktop.
A simple method to allow all origins to access your Javalin server.
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