Entrypoint

@main
enum Entrypoint
  • main() Asynchronous

    Declaration

    Swift

    static func main() async throws
  • execute(app:) Asynchronous

    Copied the Application.execute() method here, modified it to call our own copy of startup(). See below. Original header comment from Vapor sources:

    Starts the Application asynchronous using the startup() method, then waits for any running tasks to complete. If your application is started without arguments, the default argument is used.

    Under normal circumstances, execute() runs until a shutdown is triggered, then wait for the web server to (manually) shut down before returning.

    Declaration

    Swift

    static func execute(app: Application) async throws
  • startup(app:) Asynchronous

    Copied Vapor’s Application.startup() method here, modified it to call postBootConfigure() after boot but before commands are run. This lets us do things like load saved settings values from Redis after Redis is up and running but before the server starts. We also run a bunch of sanity checks on the Postgres and Redis dbs, because the sanity checks provide much better errors than Fluent/RedisKit. Original header comment from Vapor sources:

    When called, this will asynchronously execute the startup command provided through an argument. If no startup command is provided, the default is used. Under normal circumstances, this will start running Vapor’s webserver.

    If you start Vapor through this method, you’ll need to prevent your Swift Executable from closing yourself. If you want to run your Application indefinitely, or until your code shuts the application down, use execute() instead.

    Declaration

    Swift

    static func startup(app: Application) async throws