-
Notifications
You must be signed in to change notification settings - Fork 0
20. Examples: Multiple Responses
Perraco edited this page Nov 13, 2024
·
2 revisions
fun Route.createTokenRoute() {
post("/auth/token/create") {
// Implement as usual
} api {
tags = setOf("Token")
summary = "Create a new JWT token."
description = "Generates a new JWT token using Basic Authentication."
operationId = "createToken"
response<String>(status = HttpStatusCode.OK) {
description = "The generated JWT token."
contentType = seyOfType(ContentType.Text.Plain)
}
response(status = HttpStatusCode.Unauthorized) {
description = "No valid credentials provided."
}
response(status = HttpStatusCode.InternalServerError) {
description = "Failed to generate token."
}
basicSecurity(name = "TokenCreation") {
description = "Generates a new JWT token using Basic Authentication."
}
}
}