Add PostgreSQL into Vapor App

Package.swift should like something like this:

// swift-tools-version:4.1
import PackageDescription

let package = Package(
    name: "tastee",
    dependencies: [
        .package(url: "", from: "3.0.0-rc.2"),
        .package(url: "", from: "3.0.0-rc"),
        .package(url: "", from: "1.0.0-rc.2"),
    targets: [
        .target(name: "App", dependencies: ["FluentPostgreSQL", "Vapor"]),
        .target(name: "Run", dependencies: ["App"]),
        .testTarget(name: "AppTests", dependencies: ["App"])

After you change anything in Package.swift, it’s best to

  1. Close your Vapor Xcode project
  1. Let the Vapor Toolbox re-create the Xcode project.
vapor xcode -y

Prev: Install PostgreSQL In Docker

Next: Configure a Database in Vapor

Vapor 3 Tutorial Start

#postgresql #vapor #swift #swift-package #pub #db