Skip to content

Commit

Permalink
chore: set port env
Browse files Browse the repository at this point in the history
  • Loading branch information
o-az committed Feb 22, 2024
1 parent f5f5f0b commit aa6dd92
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 82 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Introspect

### ⚡ 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

#### Deployed on [Lagon](https://lagon.app/) - [Open Source JS Runtime](https://github.com/lagonapp/lagon)
### ⚡ 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

### Try it

Expand Down
7 changes: 4 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
mod graphiql;
mod index;
mod schema;

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

use graphiql::graphiql_handler;
use index::index_handler;
use schema::schema_handler;

pub type CapturedParams = (String, String);

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

let listener = tokio::net::TcpListener::bind("127.0.0.1:3443")
// port has to be $PORT for railway app to work
let port = std::env::var("PORT").unwrap_or_else(|_| "3443".to_string());

let listener = tokio::net::TcpListener::bind(format!("0.0.0.0:{}", port))
.await
.unwrap();
println!("Listening on http://{}", listener.local_addr().unwrap());
Expand Down
76 changes: 0 additions & 76 deletions src/schema.rs

This file was deleted.

0 comments on commit aa6dd92

Please sign in to comment.