Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -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")
]
)
3 changes: 2 additions & 1 deletion Sources/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import PerfectHTTP
import PerfectHTTPServer
import PerfectMustache


// Create HTTP server.
let server = HTTPServer()

Expand Down Expand Up @@ -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,
Expand Down