kotlin-server.libraries.ktor.api.mustache Maven / Gradle / Ivy
{{>licenseInfo}}
package {{apiPackage}}
import com.google.gson.Gson
import io.ktor.application.*
import io.ktor.auth.*
import io.ktor.http.*
import io.ktor.response.*
{{#featureLocations}}
import {{packageName}}.Paths
import io.ktor.locations.*
{{/featureLocations}}
import io.ktor.routing.*
import {{packageName}}.infrastructure.ApiPrincipal
{{#imports}}import {{import}}
{{/imports}}
{{#operations}}
{{#featureLocations}}
@KtorExperimentalLocationsAPI
{{/featureLocations}}
fun Route.{{classname}}() {
val gson = Gson()
val empty = mutableMapOf()
{{#operation}}
{{#hasAuthMethods}}
{{#authMethods}}
authenticate("{{{name}}}") {
{{/authMethods}}
{{/hasAuthMethods}}
{{^featureLocations}}
route("{{path}}") {
{{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}} {
{{#lambda.indented_12}}{{>libraries/ktor/_api_body}}{{/lambda.indented_12}}
}
}
{{/featureLocations}}
{{#featureLocations}}
{{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}} {
{{#lambda.indented_8}}{{>libraries/ktor/_api_body}}{{/lambda.indented_8}}
}
{{/featureLocations}}
{{#hasAuthMethods}}
}
{{/hasAuthMethods}}
{{/operation}}
}
{{/operations}}