Ktor/透過 exposed 串接資料庫

安裝

编辑

build.gradle 加上以下兩段

repositories {
    mavenLocal()
    jcenter()
    maven { url 'https://kotlin.bintray.com/ktor' }
    maven { url 'https://kotlin.bintray.com/kotlin-js-wrappers' }
    maven { url "https://dl.bintray.com/kotlin/exposed" }
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
    implementation "io.ktor:ktor-server-netty:$ktor_version"
    implementation "ch.qos.logback:logback-classic:$logback_version"
    implementation "io.ktor:ktor-server-core:$ktor_version"
    implementation "io.ktor:ktor-client-core:$ktor_version"
    implementation "io.ktor:ktor-client-core-jvm:$ktor_version"
    compile("org.jetbrains.exposed:exposed:0.3.2")
    implementation "io.ktor:ktor-jackson:$ktor_version"
    testImplementation "io.ktor:ktor-server-tests:$ktor_version"
}

等待自動匯入之後就可以了

使用

编辑

參考資料

编辑

https://github.com/JetBrains/Exposed/wiki