extensions
This commit is contained in:
@@ -67,6 +67,7 @@ dependencies {
|
||||
implementation("io.javalin:javalin:3.12.0")
|
||||
implementation("org.slf4j:slf4j-simple:1.8.0-beta4")
|
||||
implementation("org.slf4j:slf4j-api:1.8.0-beta4")
|
||||
implementation("com.fasterxml.jackson.core:jackson-databind:2.10.3")
|
||||
|
||||
|
||||
testImplementation("org.jetbrains.kotlin:kotlin-test")
|
||||
|
||||
@@ -76,7 +76,18 @@ class Main {
|
||||
@JvmStatic
|
||||
fun main(args: Array<String>) {
|
||||
val app = Javalin.create().start(4567)
|
||||
app["/", { ctx: Context -> ctx.result("Hello World") }]
|
||||
|
||||
app.before() { ctx ->
|
||||
ctx.header("Access-Control-Allow-Origin", "*")
|
||||
}
|
||||
|
||||
app.get("/api/v1/extensions") { ctx ->
|
||||
runBlocking {
|
||||
val api = ExtensionGithubApi()
|
||||
val sources = api.findExtensions()
|
||||
ctx.json(sources)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user