swifter
swifter copied to clipboard
allow root route to be dynamic
Hi,
I currently this snippet
serverInstance["/mobile"] = {
request in {
print("In Mobile")
var html = "Hello World!"
if let indexURL = Bundle.main.url(forResource: "index",
withExtension: "html",
subdirectory: "app") {
do{
html = try String(contentsOf: indexURL)
} catch {
}
}
return HttpResponse.ok(.text(html))
}()
How is it possible to so when the server is running, if I goto anything beneath mobile. the server would load the same file?
ex localhost:8080/mobile/test
would be caught in the above snippet