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