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

Initial template #100

Merged
merged 27 commits into from
Sep 23, 2024
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
42 changes: 39 additions & 3 deletions compliant-reward-distribution/indexer-and-server/src/bin/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ async fn main() -> anyhow::Result<()> {
let index_html =
reg.render_template(&index_template, &create_frontend_config(network, endpoint))?;

let router = Router::new()
let router: Router = Router::new()
// Backend routes.
.route("/api/postTweet", post(post_tweet))
.route("/api/postZKProof", post(post_zk_proof))
.route("/api/setClaimed", post(set_claimed))
Expand All @@ -235,8 +236,43 @@ async fn main() -> anyhow::Result<()> {
.route("/api/canClaim", post(can_claim))
.route("/api/getZKProofStatements", get(get_zk_proof_statements))
.route("/health", get(health))
.nest_service("/assets", serve_dir_service)
.fallback(get(|| async { Html(index_html) }))
// Frontend routes.
.route(
"/connectWallet",
get({
let index_html = index_html.clone();
move || async { Html(index_html) }
}),
)
.route(
"/tweetSubmission",
get({
let index_html = index_html.clone();
move || async { Html(index_html) }
}),
)
.route(
"/zkProofSubmission",
get({
let index_html = index_html.clone();
move || async { Html(index_html) }
}),
)
.route(
"/admin",
get({
let index_html = index_html.clone();
move || async { Html(index_html) }
}),
)
.route(
"/",
get({
let index_html = index_html.clone();
move || async { Html(index_html) }
}),
)
.nest_service("/assets", serve_dir_service.clone())
DOBEN marked this conversation as resolved.
Show resolved Hide resolved
.with_state(state)
.layer(
tower_http::trace::TraceLayer::new_for_http()
Expand Down
Loading