pub struct SsrConfig {
pub port: u16,
pub js_worker: PathBuf,
pub js_worker_log: JsWorkerLog,
pub global_js_renderer: Option<PathBuf>,
}
Expand description
A global configuration for Ssr
instance.
Fields§
§port: u16
A port that Node.js worker will be listening on.
js_worker: PathBuf
Path to Node.js worker installed from npm
. It should be relative to the
std::env::current_dir
.
js_worker_log: JsWorkerLog
Log verbosity of Node.js worker.
global_js_renderer: Option<PathBuf>
If your web app is a SPA (Single Page Application), then you should have a single entry point for all rendering requests. If it’s the case, provide a path to this file here and it will be used by the worker to render all responses. Another option is to provide a JS renderer per request but keep in mind that it would introduce additional runtime overhead since JS module has to be required during a request as opposed to requiring it once on application startup.