pub struct North { /* private fields */ }Expand description
North
HTTP and Websocket setup abstraction. It seeks to abstract away HTTP adapters and framework something simpler in Wakflo
Example
use poem_openapi::{payload::PlainText, OpenApi};
use north::{new_service};
use north::NorthServiceBuilderTrait;
#[derive(Default, Clone)]
pub struct Api;
#[OpenApi]
impl Api {
#[oai(path = "/", method = "get")]
async fn get_index(&self) -> PlainText<String> {
PlainText("Hello Example Service".to_string())
}
}
#[tokio::main]
pub async fn main() -> std::io::Result<()> {
// _server.await; // should uncomment this line
let service = new_service()
.graceful_shutdown()
.address("localhost")
.name("Example Service")
.path_prefix("/api")
.port(8000)
.controller("/", Api)
.build();
north::power(service).up();
Ok(())
}Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for North
impl !Send for North
impl !Sync for North
impl Unpin for North
impl !UnwindSafe for North
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere T: 'a,
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> TowerCompatExt for T
impl<T> TowerCompatExt for T
source§fn compat<ResBody, Err, Fut>(self) -> TowerCompatEndpoint<Self>where
ResBody: Body + Send + 'static,
<ResBody as Body>::Data: Into<Bytes> + Send + 'static,
<ResBody as Body>::Error: Error + Send + Sync + 'static,
Err: Into<Error>,
Self: Service<Request<Body>, Response = Response<ResBody>, Error = Err, Future = Fut> + Clone + Send + Sync + Sized + 'static,
Fut: Future<Output = Result<Response<ResBody>, Err>> + Send + 'static,
fn compat<ResBody, Err, Fut>(self) -> TowerCompatEndpoint<Self>where ResBody: Body + Send + 'static, <ResBody as Body>::Data: Into<Bytes> + Send + 'static, <ResBody as Body>::Error: Error + Send + Sync + 'static, Err: Into<Error>, Self: Service<Request<Body>, Response = Response<ResBody>, Error = Err, Future = Fut> + Clone + Send + Sync + Sized + 'static, Fut: Future<Output = Result<Response<ResBody>, Err>> + Send + 'static,
Converts a tower service to a poem endpoint.