|
| 1 | +<h2>Macro.swift httpd-helloworld |
| 2 | + <img src="http://zeezide.com/img/MicroExpressIcon1024.png" |
| 3 | + align="right" width="100" height="100" /> |
| 4 | +</h2> |
| 5 | + |
| 6 | +Demonstrates the use of the basic `http` module. |
| 7 | +That doesn't feature any middleware or such, but |
| 8 | +just the basic request/response mechanism. |
| 9 | + |
| 10 | +The server take a client request and returns an HTML response |
| 11 | +with some information about the submitted request. |
| 12 | + |
| 13 | +Like in Node, IncomingMessage and ServerResponse |
| 14 | +are regular streams. |
| 15 | + |
| 16 | +## Running the Sample |
| 17 | + |
| 18 | +If you have |
| 19 | +[swift-sh](https://github.com/mxcl/swift-sh) |
| 20 | +installed (`brew install swift-sh`), |
| 21 | +just starting the main.swift file works: |
| 22 | +``` |
| 23 | +$ Sources/httpd-helloworld/main.swift |
| 24 | +2020-01-07T17:14:35+0100 notice: Server listening on http://localhost:1337/ |
| 25 | +``` |
| 26 | + |
| 27 | +Or you can use `swift run` w/o installing additional software: |
| 28 | +``` |
| 29 | +$ swift run httpd-helloworld |
| 30 | +2020-01-07T21:37:05+0100 notice: Server listening on http://localhost:1337/ |
| 31 | +``` |
| 32 | + |
| 33 | +### Who |
| 34 | + |
| 35 | +**Macro** is brought to you by |
| 36 | +the |
| 37 | +[Always Right Institute](http://www.alwaysrightinstitute.com) |
| 38 | +and |
| 39 | +[ZeeZide](http://zeezide.de). |
| 40 | +We like |
| 41 | +[feedback](https://twitter.com/ar_institute), |
| 42 | +GitHub stars, |
| 43 | +cool [contract work](http://zeezide.com/en/services/services.html), |
| 44 | +presumably any form of praise you can think of. |
| 45 | + |
| 46 | +There is a `#microexpress` channel on the |
| 47 | +[Noze.io Slack](http://slack.noze.io/). Feel free to join! |
0 commit comments