-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
120 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
"type": "module", | ||
"scripts": { | ||
"start": "node .", | ||
"dev": "nodemon ." | ||
"dev": "nodemon -e js,graphql,json,pug ." | ||
}, | ||
"repository": { | ||
"type": "git", | ||
|
@@ -16,7 +16,8 @@ | |
"mina", | ||
"archive", | ||
"api", | ||
"manager" | ||
"manager", | ||
"explorer" | ||
], | ||
"author": "Serhii Pimenov <[email protected]>", | ||
"license": "MIT", | ||
|
@@ -26,15 +27,21 @@ | |
"homepage": "https://github.com/olton/minataur2#readme", | ||
"dependencies": { | ||
"@faustbrian/node-base58": "^1.0.0", | ||
"@graphql-tools/graphql-file-loader": "^8.0.0", | ||
"@graphql-tools/load": "^8.0.0", | ||
"@graphql-tools/schema": "^10.0.0", | ||
"@olton/datetime": "^3.0.2", | ||
"esm": "^3.2.25", | ||
"express": "^4.18.2", | ||
"graphql": "^16.8.1", | ||
"graphql-type-json": "^0.3.2", | ||
"graphql-yoga": "4.0.5", | ||
"node-fetch": "^3.3.2", | ||
"node-html-parser": "^6.1.6", | ||
"node-html-parser": "^6.1.10", | ||
"pg": "^8.11.3", | ||
"pg-cursor": "^2.10.3", | ||
"pug": "^3.0.2", | ||
"serve-favicon": "^2.5.0", | ||
"ws": "^8.13.0" | ||
"ws": "^8.14.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
async function fetchGraphQL(endpoint, query, variables = {}) { | ||
try { | ||
const result = await fetch( | ||
`${endpoint}`, | ||
{ | ||
method: "POST", | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, | ||
body: JSON.stringify({ | ||
query, | ||
variables, | ||
}) | ||
} | ||
) | ||
|
||
return result.ok ? await result.json() : null | ||
} catch (e) { | ||
console.error("The Request to GraphQL war aborted! " + e.name + " " + e.message) | ||
return null | ||
} | ||
} | ||
|
||
export default fetchGraphQL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import GraphQLJSON, {GraphQLJSONObject} from "graphql-type-json"; | ||
|
||
const Query = { | ||
hello: () => 'Hello World!' | ||
} | ||
|
||
const Mutation = { | ||
} | ||
|
||
const Subscription = { | ||
} | ||
|
||
const Json = { | ||
JSON: GraphQLJSON, | ||
JSONObject: GraphQLJSONObject, | ||
} | ||
|
||
export const resolvers = {Query, Mutation, Subscription, ...Json} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import {makeExecutableSchema} from "@graphql-tools/schema"; | ||
import {loadSchemaSync} from "@graphql-tools/load"; | ||
import {GraphQLFileLoader} from "@graphql-tools/graphql-file-loader"; | ||
import {resolvers} from "./resolvers/index.js"; | ||
import path from "path"; | ||
import {fileURLToPath} from "url"; | ||
|
||
const __graph = path.dirname(fileURLToPath(import.meta.url)) | ||
|
||
export const schema = makeExecutableSchema({ | ||
typeDefs: loadSchemaSync(path.resolve(__graph, 'schemas/**/*.graphql'), { | ||
loaders: [new GraphQLFileLoader()], | ||
}), | ||
resolvers | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
scalar JSON | ||
scalar JSONObject | ||
|
||
schema { | ||
query: Query | ||
mutation: Mutation | ||
subscription: Subscription | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
type Mutation { | ||
null: String | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
type Query { | ||
hello: String! | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
type Subscription { | ||
null: String! | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ const lineChartOptions = { | |
show: false | ||
}, | ||
animations: { | ||
enabled: false, | ||
speed: 300 | ||
}, | ||
height: 150, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters