Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(backend)!: separate tower and warp #65

Merged
merged 16 commits into from
Jan 22, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(backend): render html from template
  • Loading branch information
futursolo committed Jan 22, 2023
commit 3779473a4b04027baafa4cb38fb99dbd4b428576
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -148,6 +148,8 @@ jobs:
stellation-bridge
stellation-backend
stellation-backend-cli
stellation-backend-warp
stellation-backend-tower
stellation-frontend
stctl
stellation
4 changes: 2 additions & 2 deletions crates/stellation-backend/src/props.rs
Original file line number Diff line number Diff line change
@@ -41,9 +41,9 @@ where
self.request.context()
}

pub(crate) fn from_request(request: REQ) -> Self {
pub(crate) fn from_request(request: Rc<REQ>) -> Self {
Self {
request: request.into(),
request,
_marker: PhantomData,
}
}
6 changes: 4 additions & 2 deletions crates/stellation-backend/src/renderer.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::fmt;
use std::fmt::Write;
use std::marker::PhantomData;
use std::rc::Rc;

use bounce::helmet::render_static;
use stellation_bridge::{Bridge, BridgeMetadata};
@@ -90,8 +91,9 @@ where
let mut head_s = String::new();

let (reader, writer) = render_static();
let request: Rc<_> = request.into();

let props = ServerAppProps::from_request(request);
let props = ServerAppProps::from_request(request.clone());

let body_s = match bridge {
Some((bridge, bridge_metadata)) => {
@@ -126,6 +128,6 @@ where
r#"<meta name="stellation-mode" content="hydrate">"#
);

html::format_html("", helmet_tags, head_s, body_s).await
html::format_html(request.template(), helmet_tags, head_s, body_s).await
}
}