ApacheExpress Versions Save

Reliable Server Side Swift ✭ Make Apache great again!

0.7.6

7 years ago

Minor adjustments, the main feature being a demo of a typesafe-select in mods_baredemo.

dbd.select("SELECT * FROM pets") { (name : String, count : Int?) in
  req.puts("<tr><td>\(name)</td><td>\(count)</td></tr>")
}

No manual mapping required, the required static Swift types are the closure types.

0.7.5

7 years ago

As part of mod_swift we have been shipping mods_todomvc. Which is an implementation of a Todo-Backend, a simple JSON API to access and modify a list of todos. This release takes Todo-Backend one step further: Access the todos using CalDAV!

That's it. Demos how to implement a basic CalDAV/CardDAV server using Swift.

0.7.0

7 years ago

We prefer the Elephant, a lot. It is the right thing.

mod_swift 0.7.0 brings you support for accessing SQL database using Apache mod_dbd. Yes, Apache even includes SQL database support!

Enough words, this is how the code looks like:

guard let con = req.dbdAcquire()                 else { return ... }
guard let res = con.select("SELECT * FROM pets") else { return ... }

while let row = res.next() {
  req.puts("<li>\(row[0])</li>")
}

And the config looks like so:

<IfModule dbd_module>
  DBDriver  sqlite3
  DBDParams "/var/data/testdb.sqlite3"
</IfModule>

The release contains a very simple/basic wrapper library to make access to mod_dbd nicer, but is far from being a complete solution. Stay tuned.

0.6.0

7 years ago

This release brings support for using mod_swift on Ubuntu (presumably any Linux) and with Apache 2.4 servers installed via Homebrew.

Get ready to deploy!!!

0.5.0

7 years ago

Adds a simplistic Todo-MVC todo-backend.

0.4.0

7 years ago

Modularized the codebase. Instead of having one big project, there are now multiple. This provides both, a raw Apache API for those who want very little, and a Noze.io based Express framework which provides Node.js like convenience.

0.3.0

7 years ago

This:

let app = express(cookieParser(), session())

app.get("/express/cookies") { req, res, _ in
  // returns all cookies as JSON
  try res.json(req.cookies)
}

app.get("/express/") { req, res, _ in
  let tagline = arc4random_uniform(UInt32(taglines.count))

  let values : [ String : Any ] = [
    "tagline"     : taglines[Int(tagline)],
    "viewCount"   : req.session["viewCount"] ?? 0,
    "cowOfTheDay" : cows.vaca()
  ]
  try res.render("index", values)
}

and more.

Also: leftpad.

0.2.0

7 years ago

Integrated a tiny subset of Noze.io. This makes writing simple handlers, well simple:

apache.onRequest { req, res in
  res.writeHead(200, [ "Content-Type": "text/html" ])
  try res.end("<h1>Hello World</h1>")
}

0.1.0

7 years ago

First release of our mod_swift demo. Have fun!