first commit

This commit is contained in:
Christoph Hagen
2021-10-02 21:45:32 +02:00
commit ce95ce5856
10 changed files with 183 additions and 0 deletions

View File

View File

@@ -0,0 +1,10 @@
import Vapor
// configures your application
public func configure(_ app: Application) throws {
// uncomment to serve files from /Public folder
// app.middleware.use(FileMiddleware(publicDirectory: app.directory.publicDirectory))
// register routes
try routes(app)
}

11
Sources/App/routes.swift Normal file
View File

@@ -0,0 +1,11 @@
import Vapor
func routes(_ app: Application) throws {
app.get { req in
return "It works!"
}
app.get("hello") { req -> String in
return "Hello, world!"
}
}

9
Sources/Run/main.swift Normal file
View File

@@ -0,0 +1,9 @@
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()