Contents

macro-swift/macroapp

align="right" width="100" height="100" />

Example

MacroApp:

@main
struct HelloWorld: App {
  
  var body: some Endpoints {
    Use(logger("dev"), bodyParser.urlencoded())
          
    Route("/admin") {
      Get("/view") { req, res, _ in res.render("admin-index.html") }
      Render("help", template: "help")
    }
      
    Get { req, res, next in
      res.render("index.html")
    }
  }
}

Instead of this traditional route setup (as in MacroExpress):

let app = express()

app.use(logger("dev"), bodyParser.urlencoded())

app.route("/admin")
   .get("/view") { req, res, _ in res.render("admin-index.html") }

app.get("/") { req, res, _ in res.render("index.html") }

app.listen(1337) {
    console.log("Server listening on http://localhost:1337")
}

Environment Variables

  • macro.core.numthreads
  • macro.core.iothreads
  • macro.core.retain.debug
  • macro.concat.maxsize
  • macro.streams.debug.rc
  • macro.router.debug
  • macro.router.matcher.debug

Links

- Connect - Express.js

  • Swift Apache

- mod_swift - ApacheExpress

Who

MacroExpress 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/macroapp

Default branch: main

README: README.md