Repository: vapor/api-template Branch: master Commit: 7d99b769098a Files: 22 Total size: 13.7 KB Directory structure: gitextract_pbyux0u_/ ├── .circleci/ │ └── config.yml ├── .dockerignore ├── .gitignore ├── CONTRIBUTING.md ├── Package.resolved ├── Package.swift ├── Public/ │ └── .gitkeep ├── README.md ├── Sources/ │ ├── App/ │ │ ├── Controllers/ │ │ │ ├── .gitkeep │ │ │ └── TodoController.swift │ │ ├── Models/ │ │ │ ├── .gitkeep │ │ │ └── Todo.swift │ │ ├── app.swift │ │ ├── boot.swift │ │ ├── configure.swift │ │ └── routes.swift │ └── Run/ │ └── main.swift ├── Tests/ │ ├── .gitkeep │ ├── AppTests/ │ │ └── AppTests.swift │ └── LinuxMain.swift ├── cloud.yml └── web.Dockerfile ================================================ FILE CONTENTS ================================================ ================================================ FILE: .circleci/config.yml ================================================ version: 2 jobs: linux: docker: - image: swift:4.1 steps: - checkout - run: name: Compile code command: swift build - run: name: Run unit tests command: swift test linux-release: docker: - image: swift:4.1 steps: - checkout - run: name: Compile code with optimizations command: swift build -c release workflows: version: 2 tests: jobs: - linux - linux-release nightly: triggers: - schedule: cron: "0 0 * * *" filters: branches: only: - master jobs: - linux - linux-release ================================================ FILE: .dockerignore ================================================ .git .build DerivedData Package.resolved *.xcodeproj ================================================ FILE: .gitignore ================================================ Packages .build xcuserdata *.xcodeproj DerivedData/ .DS_Store .swiftpm db.sqlite ================================================ FILE: CONTRIBUTING.md ================================================ # Contributing to Vapor API Template If 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! We'll take a look as soon as we can. Thanks! ## Maintainers - [@0xTim](https://github.com/0xTim) See the [Vapor maintainers doc](https://github.com/vapor/vapor/blob/master/Docs/maintainers.md) for more information. ================================================ FILE: Package.resolved ================================================ { "object": { "pins": [ { "package": "Console", "repositoryURL": "https://github.com/vapor/console.git", "state": { "branch": null, "revision": "74cfbea629d4aac34a97cead2447a6870af1950b", "version": "3.1.1" } }, { "package": "Core", "repositoryURL": "https://github.com/vapor/core.git", "state": { "branch": null, "revision": "18f2436bf7a6bc2224372c0885db2e0159af1649", "version": "3.9.2" } }, { "package": "Crypto", "repositoryURL": "https://github.com/vapor/crypto.git", "state": { "branch": null, "revision": "df8eb7d8ae51787b3a0628aa3975e67666da936c", "version": "3.3.3" } }, { "package": "DatabaseKit", "repositoryURL": "https://github.com/vapor/database-kit.git", "state": { "branch": null, "revision": "8f352c8e66dab301ab9bfef912a01ce1361ba1e4", "version": "1.3.3" } }, { "package": "Fluent", "repositoryURL": "https://github.com/vapor/fluent.git", "state": { "branch": null, "revision": "b915c321c6f9e83743ee5efa35a30895e1b02e51", "version": "3.2.0" } }, { "package": "FluentSQLite", "repositoryURL": "https://github.com/vapor/fluent-sqlite.git", "state": { "branch": null, "revision": "c32f5bda84bf4ea691d19afe183d40044f579e11", "version": "3.0.0" } }, { "package": "HTTP", "repositoryURL": "https://github.com/vapor/http.git", "state": { "branch": null, "revision": "3808ed0401379b6e9f4a053f03090ea9d658caa9", "version": "3.2.1" } }, { "package": "Multipart", "repositoryURL": "https://github.com/vapor/multipart.git", "state": { "branch": null, "revision": "f919a01c4d10a281d6236a21b0b1d1759a72b8eb", "version": "3.0.4" } }, { "package": "Routing", "repositoryURL": "https://github.com/vapor/routing.git", "state": { "branch": null, "revision": "d76f339c9716785e5079af9d7075d28ff7da3d92", "version": "3.1.0" } }, { "package": "Service", "repositoryURL": "https://github.com/vapor/service.git", "state": { "branch": null, "revision": "fa5b5de62bd68bcde9a69933f31319e46c7275fb", "version": "1.0.2" } }, { "package": "SQL", "repositoryURL": "https://github.com/vapor/sql.git", "state": { "branch": null, "revision": "50eaeb8f52a1ce63f1ff3880e1114dd8757a78a6", "version": "2.3.2" } }, { "package": "SQLite", "repositoryURL": "https://github.com/vapor/sqlite.git", "state": { "branch": null, "revision": "314d9cd21165bcf14215e336a23ff8214f40e411", "version": "3.2.1" } }, { "package": "swift-nio", "repositoryURL": "https://github.com/apple/swift-nio.git", "state": { "branch": null, "revision": "ba7970fe396e8198b84c6c1b44b38a1d4e2eb6bd", "version": "1.14.1" } }, { "package": "swift-nio-ssl", "repositoryURL": "https://github.com/apple/swift-nio-ssl.git", "state": { "branch": null, "revision": "0f3999f3e3c359cc74480c292644c3419e44a12f", "version": "1.4.0" } }, { "package": "swift-nio-ssl-support", "repositoryURL": "https://github.com/apple/swift-nio-ssl-support.git", "state": { "branch": null, "revision": "c02eec4e0e6d351cd092938cf44195a8e669f555", "version": "1.0.0" } }, { "package": "swift-nio-zlib-support", "repositoryURL": "https://github.com/apple/swift-nio-zlib-support.git", "state": { "branch": null, "revision": "37760e9a52030bb9011972c5213c3350fa9d41fd", "version": "1.0.0" } }, { "package": "TemplateKit", "repositoryURL": "https://github.com/vapor/template-kit.git", "state": { "branch": null, "revision": "51405c83e95e8adb09565278a5e9b959c605e56c", "version": "1.4.0" } }, { "package": "URLEncodedForm", "repositoryURL": "https://github.com/vapor/url-encoded-form.git", "state": { "branch": null, "revision": "82d8d63bdb76b6dd8febe916c639ab8608dbbaed", "version": "1.0.6" } }, { "package": "Validation", "repositoryURL": "https://github.com/vapor/validation.git", "state": { "branch": null, "revision": "4de213cf319b694e4ce19e5339592601d4dd3ff6", "version": "2.1.1" } }, { "package": "Vapor", "repositoryURL": "https://github.com/vapor/vapor.git", "state": { "branch": null, "revision": "92a58a9a84e4330500b99fe355a94d29f67abe58", "version": "3.3.1" } }, { "package": "WebSocket", "repositoryURL": "https://github.com/vapor/websocket.git", "state": { "branch": null, "revision": "d85e5b6dce4d04065865f77385fc3324f98178f6", "version": "1.1.2" } } ] }, "version": 1 } ================================================ FILE: Package.swift ================================================ // swift-tools-version:4.0 import PackageDescription let package = Package( name: "VaporApp", products: [ .library(name: "VaporApp", targets: ["App"]), ], dependencies: [ // 💧 A server-side Swift web framework. .package(url: "https://github.com/vapor/vapor.git", from: "3.0.0"), // 🔵 Swift ORM (queries, models, relations, etc) built on SQLite 3. .package(url: "https://github.com/vapor/fluent-sqlite.git", from: "3.0.0") ], targets: [ .target(name: "App", dependencies: ["FluentSQLite", "Vapor"]), .target(name: "Run", dependencies: ["App"]), .testTarget(name: "AppTests", dependencies: ["App"]) ] ) ================================================ FILE: Public/.gitkeep ================================================ ================================================ FILE: README.md ================================================
================================================ FILE: Sources/App/Controllers/.gitkeep ================================================ ================================================ FILE: Sources/App/Controllers/TodoController.swift ================================================ import Vapor /// Controls basic CRUD operations on `Todo`s. final class TodoController { /// Returns a list of all `Todo`s. func index(_ req: Request) throws -> Future<[Todo]> { return Todo.query(on: req).all() } /// Saves a decoded `Todo` to the database. func create(_ req: Request) throws -> Future