Difference between revisions of "Vapor"

From Coder Merlin
m (Use Vapor-specific Environment Variables)
(Updated to dynamic library)
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== References ==
== Getting Started ==
=== Fluent ===
{{ConsoleLine|john-williams@codermerlin:~$ |<nowiki>git clone https://github.com/TheCoderMerlin/VaporShell</nowiki> }}
* [https://theswiftdev.com/get-started-with-the-fluent-orm-framework-in-vapor-4/ Getting Started with Fluent] (TheSwiftDev)
== Configuration ==
In the path: {{Pathname|./Sources/App/configure.swift}}:


<syntaxhighlight lang="swift">
== Building ==
// Set local port
{{ConsoleLine|john-williams@codermerlin:~$ |build}}
guard let portString = Environment.get("VAPOR_LOCAL_PORT") else {
    fatalError("Failed to determine VAPOR LOCAL PORT from environment")
}
guard let port = Int(portString) else {
    fatalError("Malformed VAPOR LOCAL PORT: \(portString)")
}
app.http.server.configuration.port = port


// Set local host
== Run ==
guard let hostname = Environment.get("VAPOR_LOCAL_HOST") else {
{{ConsoleLine|john-williams@codermerlin:~$ |run}}
    fatalError("Failed to determine VAPOR LOCAL HOST from environment")
 
}
The server will then answer at https://www.codermerlin.com/vapor/(user-name)/
app.http.server.configuration.hostname = hostname
</syntaxhighlight>

Revision as of 08:54, 18 January 2023

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

Getting Started[edit]

john-williams@codermerlin:~$  git clone https://github.com/TheCoderMerlin/VaporShell

Building[edit]

john-williams@codermerlin:~$  build

Run[edit]

john-williams@codermerlin:~$  run

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