Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker build -t vapor-image . | |
docker run --name vapor-server -p 8080:8080 vapor-image |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git clone https://github.com/vapor/toolbox.git | |
cd toolbox | |
# git checkout <desired version> | |
swift build -c release --disable-sandbox | |
mv .build/release/vapor /usr/local/bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cd .. | |
vapor new helloWorld |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.get("hello") { req -> String in | |
// return "Hello, World!" | |
return "Hello, 🌍!" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vapor --help |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ================================ | |
# Build image | |
# ================================ | |
FROM vapor/swift:latest as build | |
WORKDIR /build | |
# First just resolve dependencies. This creates a cached layer that can be reused | |
# as long as your Package.swift/Package.resolved files do not change. | |
COPY ./Package.* ./ | |
RUN swift package resolve |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var numbersArry = [1, 2] // array of Int | |
var numbersDict = ["one":1, "two":2] // dictionary mapping String to Int | |
var favoriteGenres: Set<String> = ["Rock", "Classical", "Hip hop"] // set of Strings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var langs = [String]() // empty array | |
langs.append("Swift") // append an element at the end of the array | |
langs.append("Python") | |
var gpaStudent = [String:Float]() // empty dictionary | |
gpaStudent["Alice"] = 4.1 | |
gpaStudent["Bob"] = 3.9 | |
var letters = Set<Character>() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let name = "Bob" | |
if (name == "Bob") { | |
print("Hello, Bob 🙂") | |
} else { | |
print("Hello, you 😅") | |
} | |
print("Bye!") | |
// Prints Hello, Bob |
OlderNewer