Last active
December 29, 2021 02:33
-
-
Save iband/ae407d60ab4a3035d9f5aa011eaeafa6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Vapor | |
public func configure(_ app: Application) throws { | |
// register routes | |
try routes(app) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// swift-tools-version:5.5 | |
// The swift-tools-version declares the minimum version of Swift required to build this package. | |
import PackageDescription | |
let package = Package( | |
name: "App", | |
products: [ | |
// ... | |
], | |
dependencies: [ | |
// Dependencies declare other packages that this package depends on. | |
// .package(url: /* package url */, from: "1.0.0"), | |
.package(url: "https://github.com/vapor/vapor.git", from: "4.0.0"), | |
], | |
targets: [ | |
// ... | |
] | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import App | |
import Vapor | |
var env = try Environment.detect() | |
try LoggingSystem.bootstrap(from: &env) | |
let app = Application(env) | |
defer { app.shutdown() } | |
try configure(app) | |
try app.run() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// swift-tools-version:5.5 | |
// The swift-tools-version declares the minimum version of Swift required to build this package. | |
import PackageDescription | |
let package = Package( | |
name: "App", | |
products: [ | |
// Products define the executables and libraries a package produces, and make them visible to other packages. | |
.library( | |
name: "App", | |
targets: ["App"]), | |
], | |
dependencies: [ | |
// Dependencies declare other packages that this package depends on. | |
// .package(url: /* package url */, from: "1.0.0"), | |
], | |
targets: [ | |
// Targets are the basic building blocks of a package. A target can define a module or a test suite. | |
// Targets can depend on other targets in this package, and on products in packages this package depends on. | |
.target( | |
name: "App", | |
dependencies: []), | |
.testTarget( | |
name: "AppTests", | |
dependencies: ["App"]), | |
] | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Vapor | |
func routes(_ app: Application) throws { | |
app.get { req in | |
return "It works!" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// swift-tools-version:5.5 | |
// The swift-tools-version declares the minimum version of Swift required to build this package. | |
import PackageDescription | |
let package = Package( | |
name: "App", | |
products: [ ... ], | |
dependencies: [ ... ], | |
targets: [ | |
// Targets are the basic building blocks of a package. A target can define a module or a test suite. | |
// Targets can depend on other targets in this package, and on products in packages this package depends on. | |
.target( | |
name: "App", | |
dependencies: [ | |
.product(name: "Vapor", package: "vapor"), | |
]), | |
.executableTarget(name: "Run", dependencies: ["App"]), | |
.testTarget( | |
name: "AppTests", | |
dependencies: ["App"]), | |
] | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment