Skip to content

t089/velox-serve

Repository files navigation

VeloxServe

Experimental, lightweight Swift HTTP server built on SwiftNIO with fully async API.

Example

You respond to HTTP requests by providing an async function (RequestReader, inout ResponseWriter) async throws -> Void to the server. Within in this function you can read the request from the given RequestReader struct and write you response to the ResponseWriter struct. Returning from this function (or throwing an error) indicates that you are done with the response.

import VeloxServe

let server = Server(
    host: "localhost", 
    port: 8080) { req, res in 
    try await res.plainText("Hello, World!\r\n")
}

try await server.run()

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages