Skip to content

damian-kolakowski/swiftX

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


**swiftx** is a web framework written in Swift 3 aiming for simplicity and performance.

* It runs on `Ubuntu`, `macOS` and `iOS`. * It has zero external dependencies (fast compilation). * It uses `poll & kqueue` sys calls (asynchronous io).

(don't worry about [swifter](https://github.com/httpswift/swifter). it's all good. swiftx will be merged with swifter).

Getting started

let server = try Server()
while true {
    try server.serve { request, responder in 
        responder(TextResponse(200, "hello"))
    }
}

HTML

let server = try Server()
while true {
    try server.serve { request, responder in 
        responder(html ~ {
            "body" ~ {
                "h1" ~ "hello"
                for _ in 1...10 { 
                    "h1" ~ "💕"
                }
            }
        })
    }
}

Demo

SQLite Database Viewer

Guest Book

Amazon Deploy

# ./deploy_to_amazon_ec2 <address> <port> <private key>
$ ./deploy_to_amazon_ec2 ubuntu@amazon.com 8080 my_key.pem

Digital Ocean Deploy

# ./deploy_to_digital_ocean <address> <port>
$ ./deploy_to_digital_ocean root@1.2.3.4 8080

🕊 Roadmap: Tests. Docker.