macro-swift/macro
align="right" width="100" height="100" />
Streams
Checkout Noze.io for people who don't know Node, most things apply to Macro as well.
What does it look like?
The Macro Examples package contains a few examples which all can run straight from the source as swift-sh scripts.
The most basic HTTP server:
#!/usr/bin/swift sh
import Macro // @Macro-swift ~> 0.8.0
http
.createServer { req, res in
res.writeHead(200, [ "Content-Type": "text/html" ])
res.write("<h1>Hello Client: \(req.url)</h1>")
res.end()
}
.listen(1337)Macro also provides additional Node-like modules, such as:
fspathjsonfileJSONbasicAuthquerystring
Environment Variables
macro.core.numthreadsmacro.core.iothreadsmacro.core.retain.debugmacro.concat.maxsizemacro.streams.debug.rc
Async/Await
This intentionally doesn't support async/await yet as proper streaming would require custom executors. Which are not yet available.
Links
- Connect - Express.js
- Swift Apache
Who
Macro is brought to you by Helge Heß / ZeeZide. We like feedback, GitHub stars, cool contract work, presumably any form of praise you can think of.
There is a #microexpress channel on the Noze.io Slack. Feel free to join!
Package Metadata
Repository: macro-swift/macro
Default branch: main
README: README.md