Skip to content

dexman/SwiftFCGI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SwiftFCGI

FCGI Swift bindings to libfcgi. Allows you to write web programs in Swift.

Example

main.swift:

try SwiftFCGI.forEachRequest() { request in
  let string = "Content-Type: text/html; charset=utf-8\r\n\r\nHello, <i>Swift</i>!"
  let data = string.dataUsingEncoding(NSUTF8StringEncoding)!
  request.output.write(UnsafePointer<UInt8>(data.bytes), maxLength: data.length)
}

lighttpd configuration

server.port = 8080
server.document-root = "/tmp"
server.modules = ("mod_fastcgi", "mod_rewrite")

url.rewrite-once = (
    "(.*)" => "/app/$1"
)

fastcgi.server = (
    "/app" => ((
        "socket" => "/tmp/test.fastcgi.socket",
        "check-local" => "disable",
        "bin-path" => "</path/to/my/program>",
        "min-procs" => 1,
        "max-procs" => 1,
        "idle-timeout" => 30
    ))
)

License

Licensed under the Apache License, Version 2.0. See LICENSE file.

About

FCGI wrapper in Swift

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published