You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.1 KiB
50 lines
1.1 KiB
package com.gyf.csams
|
|
|
|
import io.ktor.application.*
|
|
import io.ktor.features.*
|
|
import io.ktor.gson.*
|
|
import io.ktor.http.*
|
|
|
|
fun main(args: Array<String>): Unit = io.ktor.server.netty.EngineMain.main(args)
|
|
|
|
fun Application.module() {
|
|
install(CORS) {
|
|
method(HttpMethod.Options)
|
|
method(HttpMethod.Put)
|
|
method(HttpMethod.Delete)
|
|
method(HttpMethod.Patch)
|
|
header(HttpHeaders.Authorization)
|
|
header("MyCustomHeader")
|
|
allowCredentials = true
|
|
anyHost() // @TODO: Don't do this in production if possible. Try to limit it.
|
|
}
|
|
|
|
install(ContentNegotiation) {
|
|
gson()
|
|
}
|
|
|
|
install(CallLogging)
|
|
}
|
|
|
|
|
|
fun Application.Controller() {
|
|
StaticController()
|
|
AccountController()
|
|
TestController()
|
|
MainController()
|
|
AssociationController()
|
|
NotificationController()
|
|
ActivityController()
|
|
|
|
/**
|
|
* 初始化log
|
|
*/
|
|
listOf(MainService,AccountService,FileService,AssociationService,
|
|
BackgroundService,NotificationService,ActivityService,
|
|
RenameService).forEach {
|
|
it.init(environment)
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|