tauri-plugin-httpd 0.1.0

A Tauri plugin that provides multi-instance HTTP server support.
Documentation
use tauri::{command, AppHandle, Runtime};

use crate::models::*;
use crate::HttpdExt;
use crate::Result;

#[command]
pub(crate) async fn get_services<R: Runtime>(app: AppHandle<R>) -> Result<Vec<Service>> {
  app.httpd().get_services()
}

#[command]
pub(crate) async fn stop_service<R: Runtime>(app: AppHandle<R>, label: &str) -> Result<()> {
  app.httpd().stop_service(label)?;
  Ok(())
}

#[command]
pub(crate) async fn listen_static<R: Runtime>(app: AppHandle<R>, label: &str, port: u16, root: &str) -> Result<()> {
  app.httpd().listen_static(label, port, root).await?;
  Ok(())
}