diff --git a/build.gradle.kts b/build.gradle.kts index 792518e..797b31b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -11,8 +11,8 @@ plugins { kotlin("plugin.serialization") version "1.6.21" // Clean project -// id("org.jetbrains.kotlinx.kover") version "0.4.2" id("io.gitlab.arturbosch.detekt").version("1.21.0") + id("org.jetbrains.kotlinx.kover") version "0.4.2" } diff --git a/src/main/js/pluckr-app/web-dev-server.config.mjs b/src/main/js/pluckr-app/web-dev-server.config.mjs index 959af9c..d9d3efb 100644 --- a/src/main/js/pluckr-app/web-dev-server.config.mjs +++ b/src/main/js/pluckr-app/web-dev-server.config.mjs @@ -7,7 +7,7 @@ const hmr = process.argv.includes('--hmr'); export default /** @type {import('@web/dev-server').DevServerConfig} */ ({ middleware: [ proxy('/api', { - target: 'http://localhost:9090', + target: 'http://localhost:8080', }), ], diff --git a/src/main/kotlin/nl/lengrand/pluckr/Application.kt b/src/main/kotlin/nl/lengrand/pluckr/Application.kt index 7d73926..531a485 100644 --- a/src/main/kotlin/nl/lengrand/pluckr/Application.kt +++ b/src/main/kotlin/nl/lengrand/pluckr/Application.kt @@ -4,8 +4,6 @@ import UserSession import io.ktor.serialization.kotlinx.json.* import io.ktor.server.application.* import io.ktor.server.auth.* -import io.ktor.server.engine.* -import io.ktor.server.netty.* import io.ktor.server.plugins.callloging.* import io.ktor.server.plugins.contentnegotiation.* import io.ktor.server.response.* @@ -23,11 +21,11 @@ fun Application.module() { val env = environment.config.propertyOrNull("ktor.environment")?.getString() println("Running in the $env environment") - routing { - get("/api/environment") { - call.respondText(env?: "null") - } - } +// routing { +// get("/api/environment") { +// call.respondText(env?: "null") +// } +// } val database = initDb( environment.config.property("ktor.database.url").getString(), @@ -87,15 +85,4 @@ fun initDb(url: String, driver: String, user: String, password: String): Databas return database } -//fun main() { -// embeddedServer( -// Netty, -// port = 9090, -// host = "0.0.0.0" -// ){ -// module() -// } -// .start(wait = true) -//} - fun main(args: Array): Unit = io.ktor.server.netty.EngineMain.main(args) diff --git a/src/test/kotlin/nl/lengrand/pluckr/ApplicationTest.kt b/src/test/kotlin/nl/lengrand/pluckr/ApplicationTest.kt index de5f699..09da23a 100644 --- a/src/test/kotlin/nl/lengrand/pluckr/ApplicationTest.kt +++ b/src/test/kotlin/nl/lengrand/pluckr/ApplicationTest.kt @@ -1,23 +1,16 @@ package nl.lengrand.pluckr -import io.ktor.client.call.body import io.ktor.client.request.* import io.ktor.client.statement.* -import io.ktor.server.routing.* import io.ktor.http.* -import io.ktor.server.application.* -import io.ktor.server.response.* -import io.ktor.server.request.* -import kotlin.test.* import io.ktor.server.testing.* -import nl.lengrand.pluckr.plugins.* +import kotlin.test.Test +import kotlin.test.assertEquals class ApplicationTest { @Test fun testRoot() = testApplication { - application { - module() - } + application {} val response = client.get("/api/hello") assertEquals(HttpStatusCode.OK, response.status) assertEquals("Hello the World!", response.bodyAsText())