Compare commits
2 Commits
b7c087d53c
...
e56b7bb5b0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e56b7bb5b0 | ||
|
|
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,9 @@ fun Application.configureModules() {
|
||||
allowCredentials = true
|
||||
allowNonSimpleContentTypes = true
|
||||
}
|
||||
routing {
|
||||
staticFiles("/", File("web"))
|
||||
staticFiles("/character", File("web/character"))
|
||||
staticFiles("/upload", File("web"))
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user