Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
o-az committed Aug 2, 2023
1 parent ca9be6f commit b1e1d95
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 15 deletions.
32 changes: 24 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@ curl --location --silent --request 'GET' \

### Try in Browser

```sh
https://introspect.lagon.dev/<introspection-url>
# or
https://introspect.lagon.dev/json/<introspection-url>
# or
https://introspect.lagon.dev/sdl/<introspection-url>
```
[`https://introspect.lagon.dev/https://spacex-production.up.railway.app`](https://introspect.lagon.dev/https://spacex-production.up.railway.app)

or

[`https://introspect.lagon.dev/json/https://spacex-production.up.railway.app`](https://introspect.lagon.dev/json/https://spacex-production.up.railway.app)

or get the SDL

[`https://introspect.lagon.dev/sdl/https://spacex-production.up.railway.app`](https://introspect.lagon.dev/sdl/https://spacex-production.up.railway.app)

By default the API will return the schema as JSON

Expand All @@ -54,6 +56,20 @@ curl --location --silent --request 'GET' \

* **Uniswap v3**: <https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v3>
* **GitLab**: <https://gitlab.com/api/graphql> (*quite large, so small chance function timesout*)
* **SpaceX** (unoffical): <https://api.spacex.land/graphql/>
* **SpaceX** (unoffical): <https://spacex-production.up.railway.app>
* **GraphQL Pokemon**: <https://graphqlpokemon.favware.tech/v7>
* A bunch more here <https://github.com/graphql-kit/graphql-apis>

_____

❕if you want to run this yourself and you don't have access to **[Lagon Alpha](https://lagon.app/)**, install **<https://bun.sh>** and add the following a the bottom of **`./src/index.ts`**:

```ts
const port = 3000
Bun.serve({
port,
fetch: request => handler(request)
})

console.log(`Server ready at http://localhost:${port}`)
```
19 changes: 14 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,12 @@
"description": "API to fetch entire schema of any (public) GraphQL API and return it as JSON or SDL.",
"module": "./src/index.ts",
"types": "./src/index.ts",
"source": "./src/index.ts",
"type": "module",
"scripts": {
"dev": "lagon dev --env='.env.dev'",
"deploy:preview": "lagon deploy",
"deploy": "lagon deploy --production"
},
"keywords": [],
"author": "https://github.com/o-az",
"license": "GPL-3.0-or-later",
"dependencies": {
"graphql": "^16.7.1"
},
Expand All @@ -23,5 +19,18 @@
"bun-types": "^0.7.1",
"esbuild": "^0.18.17",
"typescript": "^5.1.6"
}
},
"license": "GPL-3.0-or-later",
"keywords": [
"graphql",
"introspection",
"introspect",
"schema",
"sdl",
"json"
],
"author": "Omar (https://github.com/o-az)",
"repository": "github:o-az/introspect",
"bugs": "github:o-az/introspect/issues",
"homepage": "github:o-az/introspect#readme"
}
2 changes: 0 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { isURL, errorMessage, ERROR_MESSAGE } from '#/utilities'
*/
export async function handler(request: Request): Promise<Response> {
try {

const url = new URL(request.url)
const [, ...pathParameters] = url.pathname.split('/')
const requestedFormat = pathParameters.at(0) === 'sdl' ? 'sdl' : 'json' // default to json
Expand Down Expand Up @@ -52,4 +51,3 @@ export async function handler(request: Request): Promise<Response> {
)
}
}

0 comments on commit b1e1d95

Please sign in to comment.