Live coding demo for https://speakerdeck.com/edjiang/super-spectacular-server-side-swift
git clone https://github.com/kylef/swiftenv.git ~/.swiftenv
echo 'export SWIFTENV_ROOT="$HOME/.swiftenv"' >> ~/.bash_profile
echo 'export PATH="$SWIFTENV_ROOT/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(swiftenv init -)"' >> ~/.bash_profile
swiftenv install DEVELOPMENT-SNAPSHOT-2016-05-31-a
mkdir HelloWorld
cd HelloWorld
swiftenv local DEVELOPMENT-SNAPSHOT-2016-05-31-a
swift package init --type executable
dependencies: [
.Package(url: "https://github.com/qutheory/vapor.git", majorVersion: 0, minor: 10)
]
swift package generate-xcodeproj
open HelloWorld.xcodeproj
import Vapor
let app = Application()
app.get("/") { request in
return "Hello, World!"
}
app.start()
Run the HelloWorld target in Xcode, or
swift build
.build/debug/HelloWorld
git init
heroku create
heroku buildpacks:set https://github.com/kylef/heroku-buildpack-swift
echo 'web: HelloWorld --port=$PORT' >> Procfile
git add .
git commit -m "created project"
git push heroku master