MCPcopy Create free account
hub / github.com/actix/examples / main

Function main

server-sent-events/src/main.rs:10–29  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8
9#[actix_web::main]
10async fn main() -> io::Result<()> {
11 env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
12
13 let data = Broadcaster::create();
14
15 log::info!("starting HTTP server at http://localhost:8080");
16
17 HttpServer::new(move || {
18 App::new()
19 .app_data(web::Data::from(Arc::clone(&data)))
20 .service(index)
21 .service(event_stream)
22 .service(broadcast_msg)
23 .wrap(Logger::default())
24 })
25 .bind(("127.0.0.1", 8080))?
26 .workers(2)
27 .run()
28 .await
29}
30
31#[get("/")]
32async fn index() -> impl Responder {

Callers

nothing calls this directly

Calls 2

createFunction · 0.85
runMethod · 0.80

Tested by

no test coverage detected