Skip to content

Commit a1547f2

Browse files
committed
API is now at /api
1 parent 6a48808 commit a1547f2

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

backend/src/main.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ async fn main() {
132132
debug!(trunk_bin_path = ?trunk_path, trunk_version = ?trunk_version);
133133

134134
// build our application with a single route
135-
let app = Router::new()
135+
let api = Router::new()
136136
.route("/hello", get(hello))
137137
.route("/run", post(run))
138138
.layer(
@@ -141,8 +141,9 @@ async fn main() {
141141
.timeout(Duration::from_secs(10)),
142142
)
143143
.layer(GlobalConcurrencyLimitLayer::new(1))
144-
.layer(TraceLayer::new_for_http())
145-
.layer(CorsLayer::permissive());
144+
.layer(TraceLayer::new_for_http());
145+
146+
let app = Router::new().nest("/api", api);
146147

147148
let addr = SocketAddr::new("0.0.0.0".parse().unwrap(), *PORT);
148149
info!("Server running on {}", addr);

firebase.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99
"**/target/**"
1010
],
1111
"rewrites": [
12-
{
13-
"source": "**",
14-
"destination": "/index.html"
15-
},
1612
{
1713
"source": "/api/**",
1814
"run": {
1915
"serviceId": "playground-backend",
2016
"region": "us-west1"
2117
}
18+
},
19+
{
20+
"source": "**",
21+
"destination": "/index.html"
2222
}
2323
]
2424
},

frontend/Trunk.toml

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
[[proxy]]
2+
backend = "http://localhost:3000/api"
3+
14
[[hook]]
25
stage = "build"
36
command = "npm"

0 commit comments

Comments
 (0)