Difference between revisions of "Vapor"

From Coder Merlin
Line 21: Line 21:
app.http.server.configuration.hostname = hostname
app.http.server.configuration.hostname = hostname
</syntaxhighlight>
</syntaxhighlight>
== Run ==
To run type "vapor run".  The server will then answer at https://www.codermerlin.com/vapor/(user-name)/


== References ==
== References ==
=== Fluent ===
=== Fluent ===
* [https://theswiftdev.com/get-started-with-the-fluent-orm-framework-in-vapor-4/ Getting Started with Fluent] (TheSwiftDev)
* [https://theswiftdev.com/get-started-with-the-fluent-orm-framework-in-vapor-4/ Getting Started with Fluent] (TheSwiftDev)

Revision as of 09:11, 5 October 2021

Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder

Getting Started[edit]

vapor new hello -n

Configuration[edit]

In the path: ./Sources/App/configure.swift:

// Set local port
guard let portString = Environment.get("VAPOR_LOCAL_PORT"),
      let port = Int(portString) else {
    fatalError("Failed to determine VAPOR LOCAL PORT from environment")
}
app.http.server.configuration.port = port

// Set local host
guard let hostname = Environment.get("VAPOR_LOCAL_HOST") else {
    fatalError("Failed to determine VAPOR LOCAL HOST from environment")
}
app.http.server.configuration.hostname = hostname

Run[edit]

To run type "vapor run". The server will then answer at https://www.codermerlin.com/vapor/(user-name)/

References[edit]

Fluent[edit]