pub struct ServerOptions {
pub document_store: bool,
}
Fields§
§document_store: bool
If Document
storage is allowed
Implementations§
Source§impl ServerOptions
impl ServerOptions
Sourcepub fn truthy() -> Self
pub fn truthy() -> Self
Enable all options
Examples found in repository?
examples/basic.rs (line 23)
10async fn main() {
11 dotenv::dotenv().ok(); // load .env
12
13 let port: u16 = match var("PORT") {
14 Ok(v) => v.parse::<u16>().unwrap(),
15 Err(_) => 8080,
16 };
17
18 set_var("PO_STATIC_DIR", "/static");
19 set_var("PO_NESTED", "@pongo");
20 set_var("PO_STARSTRAW", "/star");
21
22 // create database
23 let database = Database::new(Database::env_options(), ServerOptions::truthy()).await;
24 database.init().await;
25
26 let starstraw_database =
27 SRDatabase::new(Database::env_options(), SRServerOptions::truthy()).await;
28 starstraw_database.init().await;
29
30 // create app
31 let app = Router::new()
32 .nest("/star", starstraw::routes(starstraw_database.clone()))
33 .nest("/@pongo", pongo::dashboard::routes(database.clone()))
34 .nest_service("/static", get_service(ServeDir::new("./static")))
35 .fallback(pongo::api::not_found);
36
37 let listener = tokio::net::TcpListener::bind(format!("127.0.0.1:{port}"))
38 .await
39 .unwrap();
40
41 println!("Starting server at http://localhost:{port}!");
42 axum::serve(listener, app).await.unwrap();
43}
Trait Implementations§
Source§impl Clone for ServerOptions
impl Clone for ServerOptions
Source§fn clone(&self) -> ServerOptions
fn clone(&self) -> ServerOptions
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ServerOptions
impl Debug for ServerOptions
Auto Trait Implementations§
impl Freeze for ServerOptions
impl RefUnwindSafe for ServerOptions
impl Send for ServerOptions
impl Sync for ServerOptions
impl Unpin for ServerOptions
impl UnwindSafe for ServerOptions
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more