Skip to content

Commit 605574f

Browse files
committed
Update Application.kt
1 parent f4ab312 commit 605574f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/main/kotlin/Application.kt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import io.ktor.server.application.*
55
import io.ktor.server.plugins.*
66
import io.ktor.server.plugins.statuspages.*
77
import io.ktor.server.response.*
8+
import io.ktor.server.plugins.cors.routing.*
89

910
fun main(args: Array<String>) {
1011
io.ktor.server.netty.EngineMain.main(args)
@@ -21,5 +22,15 @@ fun Application.module() {
2122
}
2223
}
2324

25+
install(CORS) {
26+
anyHost()
27+
allowHeader(HttpHeaders.ContentType)
28+
allowHeader(HttpHeaders.Authorization)
29+
allowMethod(HttpMethod.Get)
30+
allowMethod(HttpMethod.Post)
31+
allowMethod(HttpMethod.Put)
32+
allowMethod(HttpMethod.Delete)
33+
}
34+
2435
configureRouting()
2536
}

0 commit comments

Comments
 (0)