Explorar el Código

Merge pull request #357 from IvanovDeveloper/stable

Added example 'How to load HTML by string?'
Victor Sigler hace 7 años
padre
commit
294dc8eaa7
Se han modificado 1 ficheros con 10 adiciones y 0 borrados
  1. 10 0
      README.md

+ 10 - 0
README.md

@@ -22,6 +22,16 @@ let server = HttpServer()
 server["/hello"] = { .ok(.html("You asked for \($0)"))  }
 server.start()
 ```
+
+### How to load HTML by string?
+```swift
+let server = HttpServer()
+server[path] = { request in
+    return HttpResponse.ok(.text("<html string>"))
+}
+server.start()
+```
+
 ### How to share files?
 ```swift
 let server = HttpServer()