Skip to content

Instantly share code, notes, and snippets.

@wpuricz
wpuricz / vapor-autocompletion.bash
Created February 21, 2017 14:32
Auto completion for working with Vapor, includes custom commands for generator
# Vapor Autocomplete
_vapor_completion() {
COMPREPLY=()
local cur="${COMP_WORDS[COMP_CWORD]}"
local prev="${COMP_WORDS[COMP_CWORD-1]}"
local vaporCommands=$(vapor --help | grep 'Usage:' | sed -E 's/^[^<]*<([^>]*)>/\1/' | tr '|' '\n' 2>/dev/null)
local genCommands="generate migration controller model resource"
@wpuricz
wpuricz / gist:c25d71409cc00340b85d8494c0dfc16a
Created February 1, 2017 14:13
Multipart upload using vapor
drop.post("upload") { request in
print(request.multipart?["image"]?.file?.data)
guard let fileData = request.multipart?["image"]?.file?.data else {
throw Abort.custom(status: .badRequest, message: "No file in request")
}
let workPath = drop.workDir
let name = UUID().uuidString + ".png"
@wpuricz
wpuricz / App Templates For Vapor.md
Last active February 1, 2017 22:09 — forked from gtranchedone/App Templates For Vapor.md
Vapor Classes Templates

Classes that I use as templates for Server Side Swift using Vapor.