Skip to content

Commit aa6dd92

Browse files
committed
chore: set port env
1 parent f5f5f0b commit aa6dd92

File tree

3 files changed

+5
-82
lines changed

3 files changed

+5
-82
lines changed

README.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# Introspect
22

3-
### ⚡ Serverless Function deployed to serve you entire schema as `JSON` or [`SDL`](https://sdk.vercel.ai/s/2x7agG8) or as a [live playground](https://introspect.lagon.dev/playground/https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v3) of any `GraphQL` API
4-
5-
#### Deployed on [Lagon](https://lagon.app/) - [Open Source JS Runtime](https://github.com/lagonapp/lagon)
3+
### ⚡ Serve you entire schema as `JSON` or [`SDL`](https://sdk.vercel.ai/s/2x7agG8) or as a [live playground](https://introspect.up.railway.app/graphiql/https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v3) of any `GraphQL` API
64

75
### Try it
86

src/main.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
mod graphiql;
22
mod index;
3-
mod schema;
43

54
use axum::{http::StatusCode, response::IntoResponse, routing::get, Router};
65
use log::{info, warn};
76
use tracing_subscriber::layer::SubscriberExt;
87

98
use graphiql::graphiql_handler;
109
use index::index_handler;
11-
use schema::schema_handler;
1210

1311
pub type CapturedParams = (String, String);
1412

@@ -24,7 +22,10 @@ async fn main() {
2422
.route("/graphiql/*endpoint", get(graphiql_handler));
2523
let app = app.fallback(handler_404);
2624

27-
let listener = tokio::net::TcpListener::bind("127.0.0.1:3443")
25+
// port has to be $PORT for railway app to work
26+
let port = std::env::var("PORT").unwrap_or_else(|_| "3443".to_string());
27+
28+
let listener = tokio::net::TcpListener::bind(format!("0.0.0.0:{}", port))
2829
.await
2930
.unwrap();
3031
println!("Listening on http://{}", listener.local_addr().unwrap());

src/schema.rs

-76
This file was deleted.

0 commit comments

Comments
 (0)