$ brew install kylef/formulae/swiftenv
$ swiftenv install 3.0.2
$ mkdir $project && cd $project && swiftenv local 3.0.2
$ swift package init --type executable
Add dependency Vapor to Package.swift
dependencies: [
.Package(url: "https://github.com/vapor/vapor.git", majorVersion: 1, minor: 3)
],
exclude: [
"Tests"
]
$ swift package update
$ swift build
And verify the result
$ swift package generate-xcodeproj
import Vapor
let drop = Droplet()
drop.get { req in
return "Hello, World!"
}
drop.run()
$ brew install vapor/tap/toolbox
$ vapor new $project
$ cd $project
$ git init
$ vapor heroku init
$ vapor xcode
- Create a new app in Heroku
- Choose a deployment method (i.e. Heroku CLI or GitHub)
- Go to your app Settings on Heroku and add a buildpack: https://github.com/vapor/heroku-buildpack
- Go to your app Settings on Heroku and copy your git repository url
- Clone your repository and add your source code
OR
$ brew install heroku
$ heroku login
$ heroku git:clone -a $project-name
OR
$ git init
$ git add --all
$ git commit -am "First commit"
and add your heroku repository url
$ touch Procfile
$ echo "web: .build/release/[YOUR-APP-NAME-HERE] --env=production --workdir=./ --config:servers.default.port=\$PORT" > Procfile
git push heroku master
- Use your current Slack team or create one (Customs Integrations are free)
- Go to settings and "Manage app" -> "Custom integration" (https://api.slack.com/custom-integrations)
- Create a slash-command and add your Swift server URL in "Integration Settings"
- According to outgoing datas slack sends, create an appropriate response containing a giphy url and id. In order to use the Giphy API, refer to: https://github.com/Giphy/GiphyAPI. The search endpoint is http://api.giphy.com/v1/gifs/search?q=[YOUR+QUERY]&api_key=dc6zaTOxFJmzC
- Go to settings and "Manage app" -> "Custom integration" (https://api.slack.com/custom-integrations)
- Create a slash-command and add your swift server url in "Integration Settings"
Then, you need to add a Redis provider to your dependencies...
import PackageDescription
let package = Package(
name: "ServerSideSwift",
dependencies: [
.Package(url: "https://github.com/vapor/vapor.git", majorVersion: 1, minor: 3),
.Package(url: "https://github.com/vapor/redis-provider.git", majorVersion: 1)
]
)
... and use it to persist votes ! (Tip: https://github.com/vapor/redis-provider)