加入web
This commit is contained in:
parent
b7c087d53c
commit
c86db987d1
@ -22,21 +22,6 @@ import java.io.File
|
||||
|
||||
fun Application.configureCharacter() {
|
||||
routing {
|
||||
route("/upload") {
|
||||
get("/{name}") {
|
||||
val fileName = call.parameters["name"] ?: run {
|
||||
call.sendNotFound()
|
||||
return@get
|
||||
}
|
||||
val file = File("./upload/$fileName")
|
||||
if(!file.exists()) {
|
||||
call.sendNotFound()
|
||||
return@get
|
||||
}
|
||||
call.respondFile(file)
|
||||
}
|
||||
}
|
||||
|
||||
route("/api") {
|
||||
route("/v1") {
|
||||
get("/characters") {
|
||||
|
||||
@ -7,8 +7,11 @@ import com.ray650128.model.User
|
||||
import io.ktor.http.*
|
||||
import io.ktor.serialization.gson.*
|
||||
import io.ktor.server.application.*
|
||||
import io.ktor.server.http.content.*
|
||||
import io.ktor.server.plugins.contentnegotiation.*
|
||||
import io.ktor.server.plugins.cors.routing.*
|
||||
import io.ktor.server.routing.*
|
||||
import java.io.File
|
||||
|
||||
fun Application.configureModules() {
|
||||
|
||||
@ -45,4 +48,8 @@ fun Application.configureModules() {
|
||||
allowCredentials = true
|
||||
allowNonSimpleContentTypes = true
|
||||
}
|
||||
routing {
|
||||
staticFiles("/", File("web"))
|
||||
staticFiles("/upload", File("web"))
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user