extensions

This commit is contained in:
Aria Moradi
2020-12-24 03:21:18 +03:30
parent c71cf587c4
commit 33c08c0b79
12 changed files with 171 additions and 93 deletions

View File

@@ -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)
}
}
}
}
}