<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class=""><font size="2" face="sans-serif" class="">How does the following
look as a sample "Hello World" app?</font>
</div></blockquote><div><br class=""></div>Looks much better to me. I would prefer the following though:</div><div><br class=""></div><div><br class=""></div><div>import HTTP</div><div><br class=""></div><div>func handler(request: HTTPRequest, response: HTTPResponseWriter ) -> HTTPBodyProcessing { <br class=""> response.writeHeader(status: .ok) <br class=""> response.writeBody("Hello, World!") <br class=""> response.done() <br class=""> return .discardBody <br class="">} <br class=""></div><div><br class=""></div><div>try! HTTPServer().start(port: 8080, handler: handler)</div><div><br class=""></div><div><br class=""></div><div><br class=""><blockquote type="cite" class=""><div class="">
<br class=""><font size="2" face="Courier New" class="">import HTTP</font>
<br class="">
<br class=""><font size="2" face="Courier New" class="">class MyServer: HTTPRequestHandling
{</font>
<br class=""><font size="2" face="Courier New" class=""> func handle(request:
HTTPRequest, response: HTTPResponseWriter ) -> HTTPBodyProcessing {</font>
<br class=""><font size="2" face="Courier New" class=""> response.writeHeader(status:
.ok)</font>
<br class=""><font size="2" face="Courier New" class=""> response.writeBody("Hello,
World!")</font>
<br class=""><font size="2" face="Courier New" class=""> response.done()</font>
<br class=""><font size="2" face="Courier New" class=""> return
.discardBody</font>
<br class=""><font size="2" face="Courier New" class=""> }</font>
<br class=""><font size="2" face="Courier New" class="">}</font>
<br class="">
<br class=""><font size="2" face="Courier New" class="">let server = HTTPServer()</font>
<br class="">
<br class=""><font size="2" face="Courier New" class="">try! server.start(port: 8080, handler:
MyServer().handle)</font>
<br class="">
<br class="">
<br class=""><font size="2" face="sans-serif" class="">Chris</font>
<br class="">
<br class="">
<br class="">
<br class=""><font size="1" color="#5f5f5f" face="sans-serif" class="">From:
</font><font size="1" face="sans-serif" class="">Georgios Moschovitis
<<a href="mailto:george.moschovitis@icloud.com" class="">george.moschovitis@icloud.com</a>></font>
<br class=""><font size="1" color="#5f5f5f" face="sans-serif" class="">To:
</font><font size="1" face="sans-serif" class="">Chris Bailey <<a href="mailto:BAILEYC@uk.ibm.com" class="">BAILEYC@uk.ibm.com</a>></font>
<br class=""><font size="1" color="#5f5f5f" face="sans-serif" class="">Cc:
</font><font size="1" face="sans-serif" class=""><a href="mailto:swift-server-dev@swift.org" class="">swift-server-dev@swift.org</a></font>
<br class=""><font size="1" color="#5f5f5f" face="sans-serif" class="">Date:
</font><font size="1" face="sans-serif" class="">03/09/2017 07:44</font>
<br class=""><font size="1" color="#5f5f5f" face="sans-serif" class="">Subject:
</font><font size="1" face="sans-serif" class="">Re: [swift-server-dev]
HTTP API Review</font>
<br class="">
<hr noshade="" class="">
<br class="">
<br class="">
<br class=""><font size="3" class="">Had a (very) quick look, and in general it looks OK.</font>
<br class=""><font size="3" class="">One thing that bothers me in the example is this ***Handler
<-> ***Handling inconsistency..</font>
<br class="">
<br class=""><font size="2" face="Courier New" class="">class SimpleHandler: HTTPRequestHandling</font>
<br class="">
<br class=""><font size="3" class="">maybe something like</font>
<br class="">
<br class=""><font size="3" class="">class WebApp: HTTPRequestHandling {</font>
<br class=""><font size="3" class=""> ...</font>
<br class=""><font size="3" class="">}</font>
<br class="">
<br class=""><font size="3" class="">would make it less confusing?</font>
<br class="">
<br class=""><font size="3" class="">-g.</font>
<br class="">
<br class="">
<br class=""><font size="2" face="sans-serif" class=""><br class="">
Unless stated otherwise above:<br class="">
IBM United Kingdom Limited - Registered in England and Wales with number
741598. <br class="">
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6
3AU<br class="">
</font></div></blockquote></div><br class=""></body></html>