實作img輸出

This commit is contained in:
Raymond Yang 2023-06-21 16:08:07 +08:00
parent 7e7c8b0698
commit b7c087d53c

View File

@ -22,6 +22,21 @@ 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") {