pub fn serve_client_code<State>(app: &mut Server<State>, code: &'static str)where
    State: Clone + Send + Sync + 'static,
Expand description

Serves a javascript file from a &'static str at the specified path. This is used to serve the client code.

Example

use titanium::web;
 
#[titanium::main]
async fn main() -> web::Result<()> {
    let mut app = web::new_server();
    web::serve_internals(&mut app);
    web::serve_client_code(&mut app, include_str!("./client.js"));
    app.listen("127.0.0.1:8080").await?;
    Ok(())
}