實作img輸出
This commit is contained in:
parent
7e7c8b0698
commit
b7c087d53c
@ -22,6 +22,21 @@ import java.io.File
|
|||||||
|
|
||||||
fun Application.configureCharacter() {
|
fun Application.configureCharacter() {
|
||||||
routing {
|
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("/api") {
|
||||||
route("/v1") {
|
route("/v1") {
|
||||||
get("/characters") {
|
get("/characters") {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user