Hyper and rust based very fast HTTP Web framework (much faster than actix and other frameworks).
Look at examples/example_server.rs
for a working example. Example can be run with cargo run --example example_server
1) Define a service class, implement Service
trait for api routing.
```rust pub struct ExampleService { // any service level properties }
impl Service for ExampleService {
async fn apihandler<'a>(
&'a self,
_: Body,
route: &HttpRoute<'a>,
path: &[&str],
) -> Result
impl ExampleService {
pub async fn gettest(&self, route: &HttpRoute<'>) -> Result
2) Optional service daemon, could be a dummy implementation - if one doesn't need it.
```rust pub struct ExampleServiceDaemon {}
impl ServiceDaemon
3) Implement ServiceBuilder
trait
```rust pub struct ExampleServiceBuilder { // any service builder level properties }
impl ServiceBuilder
Ok((service, None))
}
} ```
4) Invoke start_http_server
in your main method.
```rust
async fn main() -> Result<(), anyhow::Error> { loadconfig("examples/config", "dev")?; setuplogging("examples/config/log4rs.yml")?;
start_http_server("127.0.0.1:6464", ExampleServiceBuilder {}).await
} ```
1) /oor
- switches the in-rotation status of server
2) /status
- gives in-rotation status of server
3) /metrics/json
- metrics in JSON format
4) /metrics/prometheus
- metrics in Prometheus format
5) /api/<your-api-routes>
- all your api routes are after /api