diff --git a/inngest-core/build.gradle.kts b/inngest-core/build.gradle.kts index 27f74ef5..b2167095 100644 --- a/inngest-core/build.gradle.kts +++ b/inngest-core/build.gradle.kts @@ -15,6 +15,8 @@ dependencies { implementation("com.fasterxml.jackson.core:jackson-databind:2.16.1") implementation("com.squareup.okhttp3:okhttp:4.12.0") + implementation("io.ktor:ktor-server-core:2.3.5") + testImplementation(kotlin("test")) } diff --git a/inngest-core/src/main/kotlin/com/inngest/routing/Ktor.kt b/inngest-core/src/main/kotlin/com/inngest/routing/Ktor.kt new file mode 100644 index 00000000..42a9c2bd --- /dev/null +++ b/inngest-core/src/main/kotlin/com/inngest/routing/Ktor.kt @@ -0,0 +1,21 @@ +package com.inngest.routing + +import io.ktor.server.application.* +import io.ktor.server.response.* +import io.ktor.server.routing.* + +fun Route.inngest(path: String) { + route(path) { + get("") { + call.respondText("Get server status") + } + + post("") { + call.respondText("Invoke functions") + } + + put("") { + call.respondText("Register app") + } + } +} diff --git a/inngest-test-server/src/main/kotlin/com/inngest/App.kt b/inngest-test-server/src/main/kotlin/com/inngest/App.kt index e52bc839..1f2d36c5 100644 --- a/inngest-test-server/src/main/kotlin/com/inngest/App.kt +++ b/inngest-test-server/src/main/kotlin/com/inngest/App.kt @@ -4,8 +4,10 @@ import com.fasterxml.jackson.annotation.JsonProperty import com.inngest.CommHandler import com.inngest.FunctionOptions import com.inngest.FunctionTrigger +import com.inngest.Inngest import com.inngest.InngestEvent import com.inngest.InngestFunction +import com.inngest.routing.inngest import io.ktor.http.* import io.ktor.server.application.* import io.ktor.server.engine.* @@ -49,6 +51,8 @@ fun Application.module() { val response = comm.introspect() call.respond(HttpStatusCode.OK, response) } + + inngest("/test") } } @@ -118,7 +122,13 @@ val comm = CommHandler(functions = hashMapOf("fn-id-slug" to fn, "fn-follow-up" fun main() { var port = 8080 + var inngest = Inngest(app_id = "ktor-dev") + println("Test server running on port " + port) - embeddedServer(Netty, port, module = Application::module).start(wait = true) + embeddedServer( + Netty, + port, + module = Application::module, + ).start(wait = true) }