[
  {
    "path": ".circleci/config.yml",
    "content": "version: 2\n\njobs:\n  linux:\n    docker:\n      - image: swift:4.1\n    steps:\n      - checkout\n      - run: \n          name: Compile code\n          command: swift build\n      - run: \n          name: Run unit tests\n          command: swift test\n\n  linux-release:\n    docker:\n      - image: swift:4.1\n    steps:\n      - checkout\n      - run: \n          name: Compile code with optimizations\n          command: swift build -c release\n\nworkflows:\n  version: 2\n  tests:\n    jobs:\n      - linux\n      - linux-release\n\n  nightly:\n    triggers:\n      - schedule:\n          cron: \"0 0 * * *\"\n          filters:\n            branches:\n              only:\n                - master\n    jobs:\n      - linux\n      - linux-release\n      \n"
  },
  {
    "path": ".dockerignore",
    "content": ".git\n.build\nDerivedData\nPackage.resolved\n*.xcodeproj\n\n"
  },
  {
    "path": ".gitignore",
    "content": "Packages\n.build\nxcuserdata\n*.xcodeproj\nDerivedData/\n.DS_Store\n.swiftpm\ndb.sqlite\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "# Contributing to Vapor API Template\n\nIf you found a mistake or think of a cool new feature, please [create an issue](https://github.com/vapor/api-template/issues/new) or, if you want to implement it yourself, [fork this repo](https://github.com/vapor/api-template/fork) and open a Pull Request!\n\nWe'll take a look as soon as we can.\n\nThanks!\n\n## Maintainers\n\n- [@0xTim](https://github.com/0xTim)\n\nSee the [Vapor maintainers doc](https://github.com/vapor/vapor/blob/master/Docs/maintainers.md) for more information.\n"
  },
  {
    "path": "Package.resolved",
    "content": "{\n  \"object\": {\n    \"pins\": [\n      {\n        \"package\": \"Console\",\n        \"repositoryURL\": \"https://github.com/vapor/console.git\",\n        \"state\": {\n          \"branch\": null,\n          \"revision\": \"74cfbea629d4aac34a97cead2447a6870af1950b\",\n          \"version\": \"3.1.1\"\n        }\n      },\n      {\n        \"package\": \"Core\",\n        \"repositoryURL\": \"https://github.com/vapor/core.git\",\n        \"state\": {\n          \"branch\": null,\n          \"revision\": \"18f2436bf7a6bc2224372c0885db2e0159af1649\",\n          \"version\": \"3.9.2\"\n        }\n      },\n      {\n        \"package\": \"Crypto\",\n        \"repositoryURL\": \"https://github.com/vapor/crypto.git\",\n        \"state\": {\n          \"branch\": null,\n          \"revision\": \"df8eb7d8ae51787b3a0628aa3975e67666da936c\",\n          \"version\": \"3.3.3\"\n        }\n      },\n      {\n        \"package\": \"DatabaseKit\",\n        \"repositoryURL\": \"https://github.com/vapor/database-kit.git\",\n        \"state\": {\n          \"branch\": null,\n          \"revision\": \"8f352c8e66dab301ab9bfef912a01ce1361ba1e4\",\n          \"version\": \"1.3.3\"\n        }\n      },\n      {\n        \"package\": \"Fluent\",\n        \"repositoryURL\": \"https://github.com/vapor/fluent.git\",\n        \"state\": {\n          \"branch\": null,\n          \"revision\": \"b915c321c6f9e83743ee5efa35a30895e1b02e51\",\n          \"version\": \"3.2.0\"\n        }\n      },\n      {\n        \"package\": \"FluentSQLite\",\n        \"repositoryURL\": \"https://github.com/vapor/fluent-sqlite.git\",\n        \"state\": {\n          \"branch\": null,\n          \"revision\": \"c32f5bda84bf4ea691d19afe183d40044f579e11\",\n          \"version\": \"3.0.0\"\n        }\n      },\n      {\n        \"package\": \"HTTP\",\n        \"repositoryURL\": \"https://github.com/vapor/http.git\",\n        \"state\": {\n          \"branch\": null,\n          \"revision\": \"3808ed0401379b6e9f4a053f03090ea9d658caa9\",\n          \"version\": \"3.2.1\"\n        }\n      },\n      {\n        \"package\": \"Multipart\",\n        \"repositoryURL\": \"https://github.com/vapor/multipart.git\",\n        \"state\": {\n          \"branch\": null,\n          \"revision\": \"f919a01c4d10a281d6236a21b0b1d1759a72b8eb\",\n          \"version\": \"3.0.4\"\n        }\n      },\n      {\n        \"package\": \"Routing\",\n        \"repositoryURL\": \"https://github.com/vapor/routing.git\",\n        \"state\": {\n          \"branch\": null,\n          \"revision\": \"d76f339c9716785e5079af9d7075d28ff7da3d92\",\n          \"version\": \"3.1.0\"\n        }\n      },\n      {\n        \"package\": \"Service\",\n        \"repositoryURL\": \"https://github.com/vapor/service.git\",\n        \"state\": {\n          \"branch\": null,\n          \"revision\": \"fa5b5de62bd68bcde9a69933f31319e46c7275fb\",\n          \"version\": \"1.0.2\"\n        }\n      },\n      {\n        \"package\": \"SQL\",\n        \"repositoryURL\": \"https://github.com/vapor/sql.git\",\n        \"state\": {\n          \"branch\": null,\n          \"revision\": \"50eaeb8f52a1ce63f1ff3880e1114dd8757a78a6\",\n          \"version\": \"2.3.2\"\n        }\n      },\n      {\n        \"package\": \"SQLite\",\n        \"repositoryURL\": \"https://github.com/vapor/sqlite.git\",\n        \"state\": {\n          \"branch\": null,\n          \"revision\": \"314d9cd21165bcf14215e336a23ff8214f40e411\",\n          \"version\": \"3.2.1\"\n        }\n      },\n      {\n        \"package\": \"swift-nio\",\n        \"repositoryURL\": \"https://github.com/apple/swift-nio.git\",\n        \"state\": {\n          \"branch\": null,\n          \"revision\": \"ba7970fe396e8198b84c6c1b44b38a1d4e2eb6bd\",\n          \"version\": \"1.14.1\"\n        }\n      },\n      {\n        \"package\": \"swift-nio-ssl\",\n        \"repositoryURL\": \"https://github.com/apple/swift-nio-ssl.git\",\n        \"state\": {\n          \"branch\": null,\n          \"revision\": \"0f3999f3e3c359cc74480c292644c3419e44a12f\",\n          \"version\": \"1.4.0\"\n        }\n      },\n      {\n        \"package\": \"swift-nio-ssl-support\",\n        \"repositoryURL\": \"https://github.com/apple/swift-nio-ssl-support.git\",\n        \"state\": {\n          \"branch\": null,\n          \"revision\": \"c02eec4e0e6d351cd092938cf44195a8e669f555\",\n          \"version\": \"1.0.0\"\n        }\n      },\n      {\n        \"package\": \"swift-nio-zlib-support\",\n        \"repositoryURL\": \"https://github.com/apple/swift-nio-zlib-support.git\",\n        \"state\": {\n          \"branch\": null,\n          \"revision\": \"37760e9a52030bb9011972c5213c3350fa9d41fd\",\n          \"version\": \"1.0.0\"\n        }\n      },\n      {\n        \"package\": \"TemplateKit\",\n        \"repositoryURL\": \"https://github.com/vapor/template-kit.git\",\n        \"state\": {\n          \"branch\": null,\n          \"revision\": \"51405c83e95e8adb09565278a5e9b959c605e56c\",\n          \"version\": \"1.4.0\"\n        }\n      },\n      {\n        \"package\": \"URLEncodedForm\",\n        \"repositoryURL\": \"https://github.com/vapor/url-encoded-form.git\",\n        \"state\": {\n          \"branch\": null,\n          \"revision\": \"82d8d63bdb76b6dd8febe916c639ab8608dbbaed\",\n          \"version\": \"1.0.6\"\n        }\n      },\n      {\n        \"package\": \"Validation\",\n        \"repositoryURL\": \"https://github.com/vapor/validation.git\",\n        \"state\": {\n          \"branch\": null,\n          \"revision\": \"4de213cf319b694e4ce19e5339592601d4dd3ff6\",\n          \"version\": \"2.1.1\"\n        }\n      },\n      {\n        \"package\": \"Vapor\",\n        \"repositoryURL\": \"https://github.com/vapor/vapor.git\",\n        \"state\": {\n          \"branch\": null,\n          \"revision\": \"92a58a9a84e4330500b99fe355a94d29f67abe58\",\n          \"version\": \"3.3.1\"\n        }\n      },\n      {\n        \"package\": \"WebSocket\",\n        \"repositoryURL\": \"https://github.com/vapor/websocket.git\",\n        \"state\": {\n          \"branch\": null,\n          \"revision\": \"d85e5b6dce4d04065865f77385fc3324f98178f6\",\n          \"version\": \"1.1.2\"\n        }\n      }\n    ]\n  },\n  \"version\": 1\n}\n"
  },
  {
    "path": "Package.swift",
    "content": "// swift-tools-version:4.0\nimport PackageDescription\n\nlet package = Package(\n    name: \"VaporApp\",\n    products: [\n        .library(name: \"VaporApp\", targets: [\"App\"]),\n    ],\n    dependencies: [\n        // 💧 A server-side Swift web framework.\n        .package(url: \"https://github.com/vapor/vapor.git\", from: \"3.0.0\"),\n\n        // 🔵 Swift ORM (queries, models, relations, etc) built on SQLite 3.\n        .package(url: \"https://github.com/vapor/fluent-sqlite.git\", from: \"3.0.0\")\n    ],\n    targets: [\n        .target(name: \"App\", dependencies: [\"FluentSQLite\", \"Vapor\"]),\n        .target(name: \"Run\", dependencies: [\"App\"]),\n        .testTarget(name: \"AppTests\", dependencies: [\"App\"])\n    ]\n)\n"
  },
  {
    "path": "Public/.gitkeep",
    "content": ""
  },
  {
    "path": "README.md",
    "content": "<p align=\"center\">\n    <img src=\"https://user-images.githubusercontent.com/1342803/36623515-7293b4ec-18d3-11e8-85ab-4e2f8fb38fbd.png\" width=\"320\" alt=\"API Template\">\n    <br>\n    <br>\n    <a href=\"http://docs.vapor.codes/3.0/\">\n        <img src=\"http://img.shields.io/badge/read_the-docs-2196f3.svg\" alt=\"Documentation\">\n    </a>\n    <a href=\"https://discord.gg/vapor\">\n        <img src=\"https://img.shields.io/discord/431917998102675485.svg\" alt=\"Team Chat\">\n    </a>\n    <a href=\"LICENSE\">\n        <img src=\"http://img.shields.io/badge/license-MIT-brightgreen.svg\" alt=\"MIT License\">\n    </a>\n    <a href=\"https://circleci.com/gh/vapor/api-template\">\n        <img src=\"https://circleci.com/gh/vapor/api-template.svg?style=shield\" alt=\"Continuous Integration\">\n    </a>\n    <a href=\"https://swift.org\">\n        <img src=\"http://img.shields.io/badge/swift-5.1-brightgreen.svg\" alt=\"Swift 5.1\">\n    </a>\n</p>\n"
  },
  {
    "path": "Sources/App/Controllers/.gitkeep",
    "content": ""
  },
  {
    "path": "Sources/App/Controllers/TodoController.swift",
    "content": "import Vapor\n\n/// Controls basic CRUD operations on `Todo`s.\nfinal class TodoController {\n    /// Returns a list of all `Todo`s.\n    func index(_ req: Request) throws -> Future<[Todo]> {\n        return Todo.query(on: req).all()\n    }\n\n    /// Saves a decoded `Todo` to the database.\n    func create(_ req: Request) throws -> Future<Todo> {\n        return try req.content.decode(Todo.self).flatMap { todo in\n            return todo.save(on: req)\n        }\n    }\n\n    /// Deletes a parameterized `Todo`.\n    func delete(_ req: Request) throws -> Future<HTTPStatus> {\n        return try req.parameters.next(Todo.self).flatMap { todo in\n            return todo.delete(on: req)\n        }.transform(to: .ok)\n    }\n}\n"
  },
  {
    "path": "Sources/App/Models/.gitkeep",
    "content": ""
  },
  {
    "path": "Sources/App/Models/Todo.swift",
    "content": "import FluentSQLite\nimport Vapor\n\n/// A single entry of a Todo list.\nfinal class Todo: SQLiteModel {\n    typealias Database = SQLiteDatabase\n    /// The unique identifier for this `Todo`.\n    var id: Int?\n\n    /// A title describing what this `Todo` entails.\n    var title: String\n\n    /// Creates a new `Todo`.\n    init(id: Int? = nil, title: String) {\n        self.id = id\n        self.title = title\n    }\n}\n\n/// Allows `Todo` to be used as a dynamic migration.\nextension Todo: Migration { }\n\n/// Allows `Todo` to be encoded to and decoded from HTTP messages.\nextension Todo: Content { }\n\n/// Allows `Todo` to be used as a dynamic parameter in route definitions.\nextension Todo: Parameter { }\n"
  },
  {
    "path": "Sources/App/app.swift",
    "content": "import Vapor\n\n/// Creates an instance of `Application`. This is called from `main.swift` in the run target.\npublic func app(_ env: Environment) throws -> Application {\n    var config = Config.default()\n    var env = env\n    var services = Services.default()\n    try configure(&config, &env, &services)\n    let app = try Application(config: config, environment: env, services: services)\n    try boot(app)\n    return app\n}\n"
  },
  {
    "path": "Sources/App/boot.swift",
    "content": "import Vapor\n\n/// Called after your application has initialized.\npublic func boot(_ app: Application) throws {\n    // Your code here\n}\n"
  },
  {
    "path": "Sources/App/configure.swift",
    "content": "import FluentSQLite\nimport Vapor\n\n/// Called before your application initializes.\npublic func configure(_ config: inout Config, _ env: inout Environment, _ services: inout Services) throws {\n    // Register providers first\n    try services.register(FluentSQLiteProvider())\n\n    // Register routes to the router\n    let router = EngineRouter.default()\n    try routes(router)\n    services.register(router, as: Router.self)\n\n    // Register middleware\n    var middlewares = MiddlewareConfig() // Create _empty_ middleware config\n    // middlewares.use(FileMiddleware.self) // Serves files from `Public/` directory\n    middlewares.use(ErrorMiddleware.self) // Catches errors and converts to HTTP response\n    services.register(middlewares)\n\n    // Configure a SQLite database\n    let sqlite = try SQLiteDatabase(storage: .memory)\n\n    // Register the configured SQLite database to the database config.\n    var databases = DatabasesConfig()\n    databases.add(database: sqlite, as: .sqlite)\n    services.register(databases)\n\n    // Configure migrations\n    var migrations = MigrationConfig()\n    migrations.add(model: Todo.self, database: .sqlite)\n    services.register(migrations)\n}\n"
  },
  {
    "path": "Sources/App/routes.swift",
    "content": "import Vapor\n\n/// Register your application's routes here.\npublic func routes(_ router: Router) throws {\n    // Basic \"It works\" example\n    router.get { req in\n        return \"It works!\"\n    }\n    \n    // Basic \"Hello, world!\" example\n    router.get(\"hello\") { req in\n        return \"Hello, world!\"\n    }\n\n    // Example of configuring a controller\n    let todoController = TodoController()\n    router.get(\"todos\", use: todoController.index)\n    router.post(\"todos\", use: todoController.create)\n    router.delete(\"todos\", Todo.parameter, use: todoController.delete)\n}\n"
  },
  {
    "path": "Sources/Run/main.swift",
    "content": "import App\n\ntry app(.detect()).run()\n"
  },
  {
    "path": "Tests/.gitkeep",
    "content": ""
  },
  {
    "path": "Tests/AppTests/AppTests.swift",
    "content": "import App\nimport XCTest\n\nfinal class AppTests: XCTestCase {\n    func testNothing() throws {\n        // Add your tests here\n        XCTAssert(true)\n    }\n\n    static let allTests = [\n        (\"testNothing\", testNothing)\n    ]\n}\n"
  },
  {
    "path": "Tests/LinuxMain.swift",
    "content": ""
  },
  {
    "path": "cloud.yml",
    "content": "type: \"vapor\"\nswift_version: \"5.1.1\"\nrun_parameters: \"serve --port 8080 --hostname 0.0.0.0\"\n"
  },
  {
    "path": "web.Dockerfile",
    "content": "# You can set the Swift version to what you need for your app. Versions can be found here: https://hub.docker.com/_/swift\nFROM swift:5.1.1 as builder\n\n# For local build, add `--build-arg env=docker`\n# In your application, you can use `Environment.custom(name: \"docker\")` to check if you're in this env\nARG env\n\nRUN apt-get -qq update && apt-get install -y \\\n  libssl-dev zlib1g-dev \\\n  && rm -r /var/lib/apt/lists/*\nWORKDIR /app\nCOPY . .\nRUN mkdir -p /build/lib && cp -R /usr/lib/swift/linux/*.so* /build/lib\nRUN swift build -c release && mv `swift build -c release --show-bin-path` /build/bin\n\n# Production image\nFROM ubuntu:18.04\nARG env\n# DEBIAN_FRONTEND=noninteractive for automatic UTC configuration in tzdata\nRUN apt-get -qq update && DEBIAN_FRONTEND=noninteractive apt-get install -y \\ \n  libatomic1 libicu60 libxml2 libcurl4 libz-dev libbsd0 tzdata \\\n  && rm -r /var/lib/apt/lists/*\nWORKDIR /app\nCOPY --from=builder /build/bin/Run .\nCOPY --from=builder /build/lib/* /usr/lib/\n# Uncomment the next line if you need to load resources from the `Public` directory\n#COPY --from=builder /app/Public ./Public\n# Uncomment the next line if you are using Leaf\n#COPY --from=builder /app/Resources ./Resources\nENV ENVIRONMENT=$env\n\nENTRYPOINT ./Run serve --env $ENVIRONMENT --hostname 0.0.0.0 --port 80\n"
  }
]