Skip to content
Download

run

mach::App::run

Starts the application.

Starts the application and begins accepting incoming HTTP requests.

[[nodiscard]] int run();

Returns 0 on success. Returns a non-zero value if the application could not be started or encountered a fatal error.

The application must not already be running.

When this function returns, the application has stopped accepting new connections and all worker threads have terminated.

  • This function blocks the calling thread until the application shuts down.
  • Endpoints, middleware, and services should be registered before calling this function.
  • The application can be stopped by calling stop() from another thread.

This function is not thread-safe and must not be called concurrently.

return app.run();
Name Description
stop Stops the application.