-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'bugfix/respect-rootPath' into release
- Loading branch information
Showing
5 changed files
with
74 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/test/kotlin/io/github/smiley4/ktorswaggerui/examples/RootPathExample.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package io.github.smiley4.ktorswaggerui.examples | ||
|
||
import io.github.smiley4.ktorswaggerui.SwaggerUI | ||
import io.github.smiley4.ktorswaggerui.dsl.get | ||
import io.ktor.http.HttpStatusCode | ||
import io.ktor.server.application.Application | ||
import io.ktor.server.application.call | ||
import io.ktor.server.application.install | ||
import io.ktor.server.netty.EngineMain | ||
import io.ktor.server.response.respondText | ||
import io.ktor.server.routing.routing | ||
|
||
|
||
fun main(args: Array<String>): Unit = EngineMain.main(args) | ||
|
||
fun Application.module() { | ||
|
||
install(SwaggerUI) { | ||
swagger { | ||
swaggerUrl = "swagger-ui" | ||
forwardRoot = true | ||
} | ||
info { | ||
title = "Example API" | ||
version = "latest" | ||
description = "Example api for testing" | ||
} | ||
server { | ||
url = "http://localhost:8080" | ||
description = "Development server" | ||
} | ||
} | ||
|
||
routing { | ||
get("hello", { | ||
description = "Simple 'Hello World'- Route" | ||
response { | ||
HttpStatusCode.OK to { | ||
description = "Successful Response" | ||
} | ||
} | ||
}) { | ||
call.respondText("Hello World!") | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
ktor { | ||
deployment { | ||
host = "localhost" | ||
port = 8080 | ||
rootPath = "/root" | ||
} | ||
application { | ||
modules = [io.github.smiley4.ktorswaggerui.examples.RootPathExampleKt.module] | ||
} | ||
} |