Repository navigation
Replies: 1 comment 15 replies
|
You've stumbled across a currently undocumented feature, which will be properly documented before v0.4.x is released! In general, you shouldn't use these, since this is a very advanced feature that you shouldn't need unless you have a very advanced use case for tinkering with the deep internals of Perseus. That said, if you really want to play with this, // Get the operation the user wishes to run from environment variables
let op = perseus::engine::get_op().unwrap();
// Run the default engine with `fn` being the same as it was for the browser main, and `server_fn` being a function that returns your server (see `examples/core/custom_server` for what this could be, it's also the argument to `#[perseus::main(server_fn)]` when you use that)
let exit_code = perseus::engine::run_dflt_engine(op, fn, server_fn).await;
// Terminate the process with whatever exit code we got, so that the user gets some sensible error messages if required
std::process::exit(exit_code);Note that you must have both if you choose to use these! |
15 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
How to write code under #[perseus::engine_main] and #[perseus::browser_main]?
All reactions