我的Package.swift
长相是这样的——
import PackageDescription
let package = Package(
name: "Hello",
dependencies: [
.Package(url: "https://github.com/vapor/vapor.git", majorVersion: 1, minor: 2),
.Package(url: "https://github.com/vapor/sqlite-provider.git", majorVersion: 1, minor: 1)
],
exclude: [
"Config",
"Database",
"Localization",
"Public",
"Resources",
"Tests",
]
)
而我的main.swift
长相是这样的——
import Vapor
let drop = Droplet()
drop.get("/version") { request in
do{
let version = try drop.database?.driver.raw("SELECT sqlite_version()")
return try JSON(node: version)
} catch {
return "Sorry"
}
}
drop.resource("posts", PostController())
drop.run()
我的 sqlite.json 看起来像这样 -
{
"path": "/Users/nikhil.manapure/Desktop/Helo/newDB"
}
我的错误看起来像 -
请帮助我将 sqlite3 与 Vapor 一起使用。