Module: Bridgetown::Site::SSR::ClassMethods

Defined in:
bridgetown-core/lib/bridgetown-core/concerns/site/ssr.rb

Instance Method Summary collapse

Instance Method Details

#start_ssr!(loaders_manager: nil) ⇒ Object

Establish an SSR pipeline for a persistent backend process



11
12
13
14
15
16
17
18
19
20
21
22
# File 'bridgetown-core/lib/bridgetown-core/concerns/site/ssr.rb', line 11

def start_ssr!(loaders_manager: nil, &)
  if Bridgetown::Current.site
    raise Bridgetown::Errors::FatalException, "Bridgetown SSR already started! " \
                                              "Check your Rack app for threading issues"
  end

  site = new(Bridgetown::Current.preloaded_configuration, loaders_manager:)
  site.enable_ssr
  site.ssr_setup(&)

  site
end