mirror of
https://github.com/jlengrand/pluckr.git
synced 2026-03-10 08:41:17 +00:00
Adds kover
This commit is contained in:
@@ -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"
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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',
|
||||
}),
|
||||
],
|
||||
|
||||
|
||||
@@ -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<String>): Unit = io.ktor.server.netty.EngineMain.main(args)
|
||||
|
||||
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user