runar_gateway

Crates.iorunar_gateway
lib.rsrunar_gateway
version0.1.0
created_at2025-08-14 13:05:08.78746+00
updated_at2025-08-14 13:05:08.78746+00
descriptionRunar Gateway
homepagehttps://github.com/runar-labs/runar-rust
repositoryhttps://github.com/runar-labs/runar-rust
max_upload_size
id1794849
size125,805
Rafael Almeida (pentateu)

documentation

https://docs.rs/runar_gateway

README

Runar Gateway

HTTP gateway for Runar nodes using axum. Exposes registered service actions as REST endpoints and forwards requests to the local node.

Install

[dependencies]
runar_gateway = "0.1"

Features

  • Maps /{service-path}/{action} to the corresponding service action
  • JSON request/response bridging with ArcValue
  • CORS and tracing via tower-http

Service example (abridged)

use anyhow::Result;
use runar_macros::{service, action};
use runar_serializer::{ArcValue, Plain};

#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, PartialEq, Plain)]
struct MyTestData { id: i32, name: String, active: bool }

#[service(name = "EchoService", path = "echo-service", description = "Echo", version = "1.0.0")]
struct EchoService;

#[service]
impl EchoService {
    #[action]
    async fn ping(&self) -> Result<String> { Ok("pong".to_string()) }
    #[action]
    async fn echo(&self, message: String) -> Result<String> { Ok(message) }
    #[action]
    async fn echo_struct(&self, data: MyTestData) -> Result<MyTestData> { Ok(data) }
}

Routes (examples)

  • GET /echo-service/ping"pong"
  • POST /echo-service/echo with { "message": "hello" }"hello"
  • POST /echo-service/echo_struct with MyTestData → echo back struct

MSRV

Rust 1.70.0

License

MIT. See LICENSE.

Commit count: 0

cargo fmt