diff --git a/Package.swift b/Package.swift index 94e6afd..2ff5841 100755 --- a/Package.swift +++ b/Package.swift @@ -1,13 +1,18 @@ +// swift-tools-version:5.0 // Generated automatically by Perfect Assistant Application // Date: 2017-10-10 14:39:41 +0000 import PackageDescription let package = Package( name: "Perfect-Blog-Mustache", - targets: [], - dependencies: [ - .Package(url: "https://github.com/PerfectlySoft/Perfect-SQLite.git", majorVersion: 3), - .Package(url: "https://github.com/PerfectlySoft/Perfect-HTTPServer.git", majorVersion: 3), - .Package(url: "https://github.com/PerfectlySoft/Perfect-Mustache.git", majorVersion: 3), - .Package(url: "https://github.com/iamjono/SwiftString.git", majorVersion: 2), + dependencies: [ + .package(url: "https://github.com/PerfectlySoft/Perfect-HTTPServer.git", from: "3.0.0"), + .package(url: "https://github.com/PerfectlySoft/Perfect-SQLite.git", from: "3.0.0"), + .package(url: "https://github.com/PerfectlySoft/Perfect-Mustache.git", from: "3.0.0"), + .package(url: "https://github.com/iamjono/SwiftString.git", from: "2.0.0"), + ], + targets: [ + .target(name: "Perfect-Blog-Mustache", + dependencies: ["PerfectHTTPServer","PerfectSQLite","PerfectMustache","SwiftString"], + path: "Sources") ] ) diff --git a/Sources/main.swift b/Sources/main.swift index 4df393b..883e850 100755 --- a/Sources/main.swift +++ b/Sources/main.swift @@ -21,6 +21,7 @@ import PerfectHTTP import PerfectHTTPServer import PerfectMustache + // Create HTTP server. let server = HTTPServer() @@ -62,7 +63,7 @@ routes.add(method: .get, uris: ["/story","/story/{titleSanitized}"], handler: { // Setting the response content type explicitly to text/html response.setHeader(.contentType, value: "text/html") - if titleSanitized.characters.count > 0 { + if !titleSanitized.isEmpty { // Setting the body response to the generated list via Mustache mustacheRequest( request: request,