diff --git a/gatsby-node.js b/gatsby-node.js index 1f01018018..4b08795d35 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -1,14 +1,120 @@ const path = require("path") +const sortLibs = require("./scripts/sort-libraries") +const globby = require('globby'); +const frontmatterParser = require('parser-front-matter'); +const { readFile } = require("fs-extra"); +const { promisify } = require('util'); exports.onCreatePage = async ({ page, actions }) => { const { createPage, deletePage } = actions deletePage(page) + let context = { + ...page.context, + sourcePath: path.relative(__dirname, page.componentPath), + } + if (page.path === "/code" || page.path === "/code/") { + const markdownFilePaths = await globby('src/content/code/**/*.md'); + const codeData = {} + const slugMap = require('./src/content/code/slug-map.json'); + const parse$ = promisify(frontmatterParser.parse); + await Promise.all(markdownFilePaths.map(async markdownFilePath => { + + const markdownFileContent = await readFile(markdownFilePath, "utf-8") + let { + data: { name, description, url, github, npm, gem }, + content: howto, + } = await parse$(markdownFileContent, undefined) + howto = howto.trim(); + const pathArr = markdownFilePath.split("/") + if (markdownFilePath.includes("language-support")) { + const languageSupportDirIndex = pathArr.indexOf("language-support") + const languageNameSlugIndex = languageSupportDirIndex + 1 + const languageNameSlug = pathArr[languageNameSlugIndex] + const languageName = slugMap[languageNameSlug] + codeData.Languages = codeData.Languages || {} + codeData.Languages[languageName] = + codeData.Languages[languageName] || {} + + const categoryNameSlugIndex = languageSupportDirIndex + 2 + const categoryNameSlug = pathArr[categoryNameSlugIndex] + const categoryName = slugMap[categoryNameSlug] + codeData.Languages[languageName][categoryName] = + codeData.Languages[languageName][categoryName] || [] + codeData.Languages[languageName][categoryName].push({ + name, + description, + howto, + url, + github, + npm, + gem, + sourcePath: markdownFilePath, + }) + } else { + const codeDirIndex = pathArr.indexOf("code") + const categoryNameSlugIndex = codeDirIndex + 1 + const categoryNameSlug = pathArr[categoryNameSlugIndex] + const categoryName = slugMap[categoryNameSlug] + codeData[categoryName] = codeData[categoryName] || [] + codeData[categoryName].push({ + name, + description, + howto, + url, + github, + npm, + gem, + sourcePath: markdownFilePath, + }) + } + })) + const languageList = [] + let sortedTools = [] + await Promise.all([ + Promise.all( + Object.keys(codeData.Languages).map(async languageName => { + const libraryCategoryMap = codeData.Languages[languageName] + let languageTotalStars = 0 + await Promise.all( + Object.keys(libraryCategoryMap).map(async libraryCategoryName => { + const libraries = libraryCategoryMap[libraryCategoryName] + const { sortedLibs, totalStars } = await sortLibs(libraries) + libraryCategoryMap[libraryCategoryName] = sortedLibs + languageTotalStars += totalStars || 0 + }) + ) + languageList.push({ + name: languageName, + totalStars: languageTotalStars, + categoryMap: libraryCategoryMap, + }) + }) + ), + sortLibs(codeData.Tools).then(({ sortedLibs }) => { + sortedTools = sortedLibs + }), + ]) + + context = { + ...context, + otherLibraries: { + Services: codeData.Services, + Tools: sortedTools, + "More Stuff": codeData["More Stuff"], + }, + languageList: languageList.sort((a, b) => { + if (a.totalStars > b.totalStars) { + return -1 + } else if (a.totalStars < b.totalStars) { + return 1 + } + return 0 + }), + } + } createPage({ ...page, - context: { - ...page.context, - sourcePath: path.relative(__dirname, page.componentPath), - }, + context, }) } @@ -64,7 +170,10 @@ exports.createPages = async ({ graphql, actions }) => { parent: { relativeDirectory, sourceInstanceName }, } = node - if (sourceInstanceName !== "content") { + if ( + sourceInstanceName !== "content" || + relativeDirectory.includes("code") + ) { return } @@ -176,7 +285,7 @@ exports.createPages = async ({ graphql, actions }) => { categoriesMap[currentCategory.name] = currentCategory } - sideBardata[folder] = Object.values(categoriesMap); + sideBardata[folder] = Object.values(categoriesMap) }) ) diff --git a/package.json b/package.json index 81fe1469a0..05aec6b240 100644 --- a/package.json +++ b/package.json @@ -24,13 +24,17 @@ "gatsby-plugin-webfonts": "1.1.3", "gatsby-source-filesystem": "2.4.0", "gatsby-transformer-remark": "2.9.0", + "globby": "11.0.1", "graphql": "15.4.0", "marked": "1.2.2", + "numbro": "2.3.2", + "parser-front-matter": "1.6.4", "prism-react-renderer": "1.1.1", "prismjs": "1.22.0", "react": "17.0.1", "react-dom": "17.0.1", - "react-helmet": "6.1.0" + "react-helmet": "6.1.0", + "timeago.js": "4.0.2" }, "devDependencies": { "@types/codemirror": "0.0.98", diff --git a/scripts/sort-libraries.js b/scripts/sort-libraries.js new file mode 100644 index 0000000000..a0fd747b63 --- /dev/null +++ b/scripts/sort-libraries.js @@ -0,0 +1,209 @@ +const fetch = require(`node-fetch`); +const numbro = require("numbro"); +const timeago = require('timeago.js'); + +const getGitHubStats = async githubRepo => { + const [owner, repoName] = githubRepo.split("/") + const accessToken = process.env.GITHUB_ACCESS_TOKEN + if (!accessToken) { + return {}; + } + const query = /* GraphQL */ ` + fragment defaultBranchRefFragment on Ref { + target { + ... on Commit { + history(since: $since) { + edges { + node { + author { + name + } + pushedDate + } + } + } + } + } + } + query($owner: String!, $repoName: String!, $since: GitTimestamp!) { + repositoryOwner(login: $owner) { + repository(name: $repoName) { + defaultBranchRef { + ...defaultBranchRefFragment + } + stargazers { + totalCount + } + updatedAt + forkCount + pullRequests { + totalCount + } + description + licenseInfo { + name + } + releases(last: 1) { + nodes { + publishedAt + } + } + tags: refs(refPrefix: "refs/tags/", first: 1, orderBy: {field: TAG_COMMIT_DATE, direction: DESC}) { + nodes { + name + target { + ... on Tag { + target { + ... on Commit { + pushedDate + } + } + } + } + } + } + } + } + } + ` + const lastMonth = new Date() + lastMonth.setMonth(lastMonth.getMonth() - 3) + const response = await fetch("https://api.github.com/graphql", { + method: "POST", + body: JSON.stringify({ + query, + variables: { owner, repoName, since: lastMonth }, + }), + headers: { + Authorization: `Bearer ${accessToken}`, + "Content-Type": "application/json", + }, + }) + const responseJson = await response.json() + if (responseJson && responseJson.errors) { + throw JSON.stringify(responseJson.errors); + } + if (!responseJson || !responseJson.data) { + throw `GitHub returned empty response for ${owner}/${repoName}` + } + const { repositoryOwner } = responseJson.data + if (!repositoryOwner) { + throw `No GitHub user found for ${owner}/${repoName}` + } + const { repository: repo } = repositoryOwner + if (!repo) { + throw `No GitHub repo found ${owner}/${repoName}` + } + const stars = repo.stargazers.totalCount + const commitHistory = repo.defaultBranchRef.target.history.edges + + let hasCommitsInLast3Months = false; + commitHistory.forEach(commit => { + if (!commit.node.author.name.match(/bot/i)) { + hasCommitsInLast3Months = true; + } + }) + const formattedStars = numbro(stars).format({ + average: true, + }); + + const releases = []; + if (repo.tags && repo.tags.nodes && repo.tags.nodes.length && repo.tags.nodes[0].target.target && repo.tags.nodes[0].target.target.pushedDate) { + releases.push(repo.tags.nodes[0].target.target.pushedDate); + } + if (repo.releases && repo.releases.nodes && repo.releases.nodes.length) { + releases.push(repo.releases.nodes[0].publishedAt) + } + if(owner.includes("graphql")) { + console.log({ releases, repoName }) + } + + const lastRelease = releases.filter(Boolean).sort().reverse()[0] + + return { + hasCommitsInLast3Months, + stars, + formattedStars, + license: repo.licenseInfo && repo.licenseInfo.name, + lastRelease, + formattedLastRelease: lastRelease && timeago.format(lastRelease), + } +} + +const getNpmStats = async packageName => { + const response = await fetch( + `https://api.npmjs.org/downloads/point/last-week/${encodeURIComponent( + packageName + )}` + ) + const responseJson = await response.json() + const downloadCount = responseJson.downloads + return { downloadCount } +} + +const getGemStats = async packageName => { + const response = await fetch( + `https://rubygems.org/api/v1/gems/${encodeURIComponent(packageName)}.json` + ) + const responseJson = await response.json() + const downloadCount = responseJson.downloads + return { downloadCount } +} + +const sortLibs = async libs => { + let totalStars = 0; + const libsWithScores = await Promise.all( + libs.map(async lib => { + const [ + npmStats = {}, + gemStars = {}, + githubStats = {}, + ] = await Promise.all([ + lib.npm && getNpmStats(lib.npm), + lib.gem && getGemStats(lib.gem), + lib.github && getGitHubStats(lib.github), + ]) + const result = { + ...lib, + ...npmStats, + ...gemStars, + ...githubStats, + } + totalStars += result.stars || 0; + return result; + }) + ) + const sortedLibs = libsWithScores.sort((a, b) => { + let aScore = 0, + bScore = 0 + if ("downloadCount" in a && 'downloadCount' in b) { + if (a.downloadCount > b.downloadCount) { + aScore += 40 + } else if (b.downloadCount > a.downloadCount) { + bScore += 40 + } + } + if ("hasCommitsInLast3Months" in a && a.hasCommitsInLast3Months) { + aScore += 30 + } + if ("hasCommitsInLast3Months" in b && b.hasCommitsInLast3Months) { + bScore += 30 + } + if ('stars' in a && 'stars' in b) { + if (a.stars > b.stars) { + aScore += 40 + } else if (a.stars < b.stars) { + bScore += 40 + } + } + if (bScore > aScore) { + return 1 + } else if (bScore < aScore) { + return -1 + } + return 0 + }) + return { sortedLibs, totalStars } +} + +module.exports = sortLibs diff --git a/src/assets/css/_css/code.less b/src/assets/css/_css/code.less index 139da22628..7cd96810e9 100644 --- a/src/assets/css/_css/code.less +++ b/src/assets/css/_css/code.less @@ -53,9 +53,220 @@ left: 0; } .intro-note { - margin-top: 20px; + margin-top: 43px; + display: flex; + p { + width: 50%; + margin-top: 0; + margin-right: 5%; + font-size: 18px; + font-family: "Rubik", "Helvetica Neue", Helvetica, Arial, sans-serif; + line-height: 32px; + } + .goto-section { + display: flex; + flex-direction: row; + width: 40%; + p { + min-width: 72px; + width: 20%; + margin: 0; + color: #8c8c8c; + font-weight: bold; + font-size: 24px; + font-family: "Rubik", "Helvetica Neue", Helvetica, Arial, sans-serif; + } + .sections { + display: flex; + width: 80%; + flex-direction: column; + a { + h3 { + margin: 0 0 22px 0; + border-left: 1px solid #b7b7b7; + font-weight: bold; + padding-left: 15px; + line-height: 28px; + font-size: 24px; + font-family: "Rubik", "Helvetica Neue", Helvetica, Arial, sans-serif; + } + } + } + } } .inner-content { max-width: 100%; } + .language-content { + padding-top: 72px; + } + .languages-title { + font-size: 24px; + font-weight: bold; + font-family: "Rubik", "Helvetica Neue", Helvetica, Arial, sans-serif; + } + .language-boxes { + display: grid; + grid-row-gap: 20px; + grid-column-gap: 30px; + grid-template-columns: auto auto auto; + @media screen and (min-width: 1020px) { + grid-template-columns: auto auto auto auto auto auto; + } + .language-box { + border: 1px solid #979797; + min-width: 142px; + height: 120px; + display: flex; + flex-direction: row; + align-items: flex-end; + color: #000; + .article_title { + text-align: left; + font-size: 22px; + color: #000; + font-weight: bold; + font-family: "Rubik", "Helvetica Neue", Helvetica, Arial, sans-serif; + margin: 0; + } + } + } + .language-header { + display: flex; + flex-direction: row; + @media screen and (max-width: 600px) { + flex-direction: column; + } + justify-content: space-between; + .language-title { + margin: 0 0 10px 0; + font-size: 48px; + font-weight: bold; + } + .language-categories-permalinks { + margin: 0; + font-size: 24px; + font-weight: bold; + color: #a6a6a6; + .language-category-permalink { + color: #a6a6a6; + } + } + } + .library-category-title { + margin: 0; + padding-top: 45px; + font-size: 24px; + color: #a6a6a6; + font-weight: bold; + } + .library-info { + display: flex; + flex-direction: row; + @media screen and (max-width: 600px) { + flex-direction: column; + } + justify-content: space-between; + margin-top: 36px; + margin-bottom: 40px; + .library-details { + width: 30%; + @media screen and (max-width: 600px) { + width: 100%; + } + .library-name { + font-size: 24px; + font-weight: bold; + p { + margin: 0 0 20px 0; + } + } + .library-detail { + margin-top: 7px; + display: flex; + flex-direction: row; + b { + font-size: 14px; + min-width: 90px; + } + a, + span { + font-size: 16px; + color: #e10098; + font-weight: bold; + margin-left: 10px; + } + } + .library-description { + margin-top: 30px; + } + } + .library-howto { + @media screen and (max-width: 600px) { + width: 100%; + } + width: 60%; + position: relative; + .library-howto-content { + overflow: hidden; + pre.prism { + margin: 1em 0; + } + + &.not-expanded { + max-height: 450px; + } + &.expanded img { + display: none; + } + p { + margin: 0; + } + } + } + .library-howto-expand { + cursor: pointer; + + &.not-expanded { + background: -webkit-linear-gradient( + top, + rgba(237, 239, 240, 0), + rgba(237, 239, 240, 0) 380px, + #ffffff 400px + ); + background: linear-gradient( + to bottom, + rgba(237, 239, 240, 0), + rgba(237, 239, 240, 0) 380px, + #ffffff 400px + ); + box-sizing: border-box; + display: block; + height: 450px; + padding-top: 400px; + position: absolute; + top: 0; + right: 0; + left: 0; + text-align: center; + .library-howto-expand-anchor { + background: #ffffff; + -moz-box-sizing: border-box; + box-sizing: border-box; + border-radius: 9pt 9pt 0 0; + color: #8c8c8c; + display: inline-block; + max-width: 100%; + overflow: hidden; + padding: 10px; + text-decoration: underline; + text-overflow: ellipsis; + white-space: nowrap; + } + } + &.expanded { + display: none; + } + } + } } diff --git a/src/components/BlogLayout/index.tsx b/src/components/BlogLayout/index.tsx index 7f69784438..8111e5bd1b 100644 --- a/src/components/BlogLayout/index.tsx +++ b/src/components/BlogLayout/index.tsx @@ -10,6 +10,7 @@ interface Props { guestBio: string rawMarkdownBody: string sideBarData: any + pageContext: any } const index = ({ @@ -20,6 +21,7 @@ const index = ({ guestBio, rawMarkdownBody, sideBarData, + pageContext }: Props) => { return (
@@ -32,17 +34,21 @@ const index = ({ guestBio={guestBio} rawMarkdownBody={rawMarkdownBody} isPermalink={true} + pageContext={pageContext} /> - { - const aDate = new Date(a.frontmatter.date); + { + const aDate = new Date(a.frontmatter.date) const bDate = new Date(b.frontmatter.date) if (aDate > bDate) { - return -1; + return -1 } else if (aDate < bDate) { - return 1; + return 1 } - return 0; - }))} currentPermalink={permalink} /> + return 0 + })} + currentPermalink={permalink} + />
) diff --git a/src/components/BlogPost/index.tsx b/src/components/BlogPost/index.tsx index 5c22cda2fc..6793594ad0 100644 --- a/src/components/BlogPost/index.tsx +++ b/src/components/BlogPost/index.tsx @@ -9,6 +9,7 @@ interface Props { guestBio: string rawMarkdownBody: string isPermalink: boolean + pageContext: any } const BlogPost = ({ @@ -19,6 +20,7 @@ const BlogPost = ({ guestBio, rawMarkdownBody, isPermalink, + pageContext }: Props) => (

{isPermalink ? title : {title}}

@@ -29,7 +31,7 @@ const BlogPost = ({ {guestBio && (

{`This guest article contributed by ${byline}, ${guestBio}.`}

)} - {rawMarkdownBody} + {rawMarkdownBody}
) diff --git a/src/components/CodeLayout/index.tsx b/src/components/CodeLayout/index.tsx index 3364e24bcc..a6ead78a0a 100644 --- a/src/components/CodeLayout/index.tsx +++ b/src/components/CodeLayout/index.tsx @@ -1,12 +1,12 @@ import React from 'react' import Marked from "../Marked"; -export default ({ title, rawMarkdownBody }: any) => ( +export default ({ title, rawMarkdownBody, pageContext }: any) => (

{title}

- {rawMarkdownBody} + {rawMarkdownBody}
diff --git a/src/components/DocsLayout/index.tsx b/src/components/DocsLayout/index.tsx index bc057a8a1b..f0d6e9b321 100644 --- a/src/components/DocsLayout/index.tsx +++ b/src/components/DocsLayout/index.tsx @@ -9,15 +9,16 @@ interface Props { permalink: string sideBarData: any rawMarkdownBody: string + pageContext: any } -const index = ({ title, nextDoc, sideBarData, rawMarkdownBody }: Props) => { +const index = ({ title, nextDoc, sideBarData, rawMarkdownBody, pageContext }: Props) => { return (

{title}

- {rawMarkdownBody} + {rawMarkdownBody} {nextDoc?.frontmatter?.permalink && ( diff --git a/src/components/Footer/index.tsx b/src/components/Footer/index.tsx index 85fb641136..b5defcbcf3 100644 --- a/src/components/Footer/index.tsx +++ b/src/components/Footer/index.tsx @@ -28,9 +28,9 @@ const getLinks = (sourcePath: string): FooterLinks[] => [ text: "Code", href: "/code", subsections: [ - { text: "Servers", href: "/code/#server-libraries" }, - { text: "Clients", href: "/code/#graphql-clients" }, + { text: "Languages", href: "/code/#languages" }, { text: "Tools", href: "/code/#tools" }, + { text: "Services", href: "/code/#services" }, ], }, { diff --git a/src/components/Marked/index.tsx b/src/components/Marked/index.tsx index 7c43477620..3e3d88455b 100644 --- a/src/components/Marked/index.tsx +++ b/src/components/Marked/index.tsx @@ -14,8 +14,8 @@ import MiniGraphiQL from "./MiniGraphiQL" import { StarWarsSchema } from "./swapiSchema" import { UsersSchema } from './usersSchema'; -export default function Marked(props) { - return
{marked(props.children, props)}
+export default function Marked(props: { pageContext: any; children: any; }) { + return
{props.children && marked(props.children, props)}
} /** diff --git a/src/content/code/code.md b/src/content/code/code.md deleted file mode 100644 index 29e381a0f9..0000000000 --- a/src/content/code/code.md +++ /dev/null @@ -1,795 +0,0 @@ ---- -title: Code -layout: code -permalink: /code/ ---- - -Many different programming languages support GraphQL. This list contains some of the more popular server-side frameworks, client libraries, services, and other useful stuff. - -## Server Libraries - -In addition to the GraphQL [reference implementations in JavaScript](#javascript), server libraries include: - -- [C# / .NET](#c-net) -- [Clojure](#clojure) -- [D](#d) -- [Elixir](#elixir) -- [Erlang](#erlang) -- [Go](#go) -- [Groovy](#groovy) -- [Haskell](#haskell) -- [Java](#java) -- [JavaScript](#javascript) -- [Julia](#julia) -- [Kotlin](#kotlin) -- [Perl](#perl) -- [PHP](#php) -- [Python](#python) -- [R](#r) -- [Ruby](#ruby) -- [Rust](#rust) -- [Scala](#scala) -- [Swift](#swift) -- [OCaml / Reason](#ocaml-reason) - -### C# / .NET - -#### [graphql-dotnet](https://github.com/graphql-dotnet/graphql-dotnet): GraphQL for .NET - -```csharp -using System; -using GraphQL; -using GraphQL.Types; - -public class Program -{ - public static void Main(string[] args) - { - var schema = Schema.For(@" - type Query { - hello: String - } - "); - - var json = schema.Execute(_ => - { - _.Query = "{ hello }"; - _.Root = new { Hello = "Hello World!" }; - }); - - Console.WriteLine(json); - } -} -``` - - - [graphql-net](https://github.com/ckimes89/graphql-net): Convert GraphQL to IQueryable - - [Entity GraphQL](https://github.com/lukemurray/EntityGraphQL): .NET Core GraphQL library. Compiles to IQueryable to easily expose a schema from an existing data model (E.g. from an Entity Framework data model) - - [DotNetGraphQLQueryGen](https://github.com/lukemurray/DotNetGraphQLQueryGen): .NET Core library to generate classes from a GraphQL schema for type-safe querying in dotnet - - [Hot Chocolate](https://github.com/ChilliCream/hotchocolate): GraphQL Server for .NET core and .NET classic - - [NGraphQL](https://github.com/rivantsov/starwars): GraphQL Server for .NET Core and full framework - -### Clojure - -#### [alumbra](https://github.com/alumbra/alumbra) - -A set of reusable GraphQL components for Clojure conforming to the data structures given in [alumbra.spec](https://github.com/alumbra/alumbra.spec). - -```clojure -(require '[alumbra.core :as alumbra] - '[claro.data :as data]) - -(def schema - "type Person { name: String!, friends: [Person!]! } - type QueryRoot { person(id: ID!): Person, me: Person! } - schema { query: QueryRoot }") - -(defrecord Person [id] - data/Resolvable - (resolve! [_ _] - {:name (str "Person #" id) - :friends (map ->Person (range (inc id) (+ id 3)))})) - -(def QueryRoot - {:person (map->Person {}) - :me (map->Person {:id 0})}) - -(def app - (alumbra/handler - {:schema schema - :query QueryRoot})) - -(defonce my-graphql-server - (aleph.http/start-server #'app {:port 3000})) -``` - -```bash -$ curl -XPOST "http://0:3000" -H'Content-Type: application/json' -d'{ - "query": "{ me { name, friends { name } } }" -}' -{"data":{"me":{"name":"Person #0","friends":[{"name":"Person #1"},{"name":"Person #2"}]}}} -``` - -#### [graphql-clj](https://github.com/tendant/graphql-clj) - -A Clojure library that provides a GraphQL implementation. - -Code that executes a hello world GraphQL query with `graphql-clj`: - -```clojure - -(def schema "type QueryRoot { - hello: String - }") - -(defn resolver-fn [type-name field-name] - (get-in {"QueryRoot" {"hello" (fn [context parent & rest] - "Hello world!")}} - [type-name field-name])) - -(require '[graphql-clj.executor :as executor]) - -(executor/execute nil schema resolver-fn "{ hello }") -``` - -#### [lacinia](https://github.com/walmartlabs/lacinia) - -A full implementation of the GraphQL specification that aims to maintain external compliance with the specification. - -### D - - - [graphqld](https://github.com/burner/graphqld): A GraphQL implementaiton for the D Programming Language. - -### Elixir - - - [absinthe](https://github.com/absinthe-graphql/absinthe): GraphQL implementation for Elixir. - - [graphql-elixir](https://github.com/graphql-elixir/graphql): An Elixir implementation of Facebook's GraphQL. - -### Erlang - - - [graphql-erlang](https://github.com/shopgun/graphql-erlang): GraphQL implementation in Erlang. - -### Go - - - [graphql-go](https://github.com/graphql-go/graphql): An implementation of GraphQL for Go / Golang. - - [graph-gophers/graphql-go](https://github.com/graph-gophers/graphql-go): An active implementation of GraphQL in Golang (was https://github.com/neelance/graphql-go). - - [99designs/gqlgen](https://github.com/99designs/gqlgen) - Go generate based graphql server library. - - [graphql-relay-go](https://github.com/graphql-go/relay): A Go/Golang library to help construct a graphql-go server supporting react-relay. - - [samsarahq/thunder](https://github.com/samsarahq/thunder): A GraphQL implementation with easy schema building, live queries, and batching. - - [appointy/jaal](https://github.com/appointy/jaal): Develop spec compliant GraphQL servers in Go. - -### Groovy - -#### [gorm-graphql](https://github.com/grails/gorm-graphql/) - -**Core Library** - The GORM GraphQL library provides functionality to generate a GraphQL schema based on your GORM entities. In addition to mapping domain classes to a GraphQL schema, the core library also provides default implementations of "data fetchers" to query, update, and delete data through executions of the schema. - -**Grails Plugin** - In a addition to the Core Library, the GORM GraphQL Grails Plugin: - -- Provides a controller to receive and respond to GraphQL requests through HTTP, based on their guidelines. -- Generates the schema at startup with spring bean configuration to make it easy to extend. -- Includes a [GraphiQL](https://github.com/graphql/graphiql) browser enabled by default in development. The browser is accessible at /graphql/browser. -- Overrides the default data binder to use the data binding provided by Grails -- Provides a [trait](https://grails.github.io/gorm-graphql/latest/api/org/grails/gorm/graphql/plugin/testing/GraphQLSpec.html) to make integration testing of your GraphQL endpoints easier - -See [the documentation](https://grails.github.io/gorm-graphql/latest/guide/index.html) for more information. - -#### [GQL](https://grooviter.github.io/gql/) - -GQL is a Groovy library for GraphQL - -### Haskell - -#### [Morpheus GraphQL](https://github.com/morpheusgraphql/morpheus-graphql) - -A Haskell library for building GraphQL APIs. - -Hello world example with `morpheus-graphql`: - -```graphql -# schema.gql -""" -A supernatural being considered divine and sacred -""" -type Deity { - name: String! - power: String @deprecated(reason: "no more supported") -} - -type Query { - deity(name: String! = "Morpheus"): Deity! -} -``` - - -```haskell -{-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE DuplicateRecordFields #-} -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE FlexibleInstances #-} -{-# LANGUAGE MultiParamTypeClasses #-} -{-# LANGUAGE NamedFieldPuns #-} -{-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE ScopedTypeVariables #-} -{-# LANGUAGE TemplateHaskell #-} -{-# LANGUAGE TypeFamilies #-} - -module API (api) where - -import Data.ByteString.Lazy.Char8 (ByteString) -import Data.Morpheus (interpreter) -import Data.Morpheus.Document (importGQLDocument) -import Data.Morpheus.Types (RootResolver (..), Undefined (..)) -import Data.Text (Text) - -importGQLDocument "schema.gql" - -rootResolver :: RootResolver IO () Query Undefined Undefined -rootResolver = - RootResolver - { queryResolver = Query {deity}, - mutationResolver = Undefined, - subscriptionResolver = Undefined - } - where - deity DeityArgs {name} = - pure - Deity - { name = pure name, - power = pure (Just "Shapeshifting") - } - -api :: ByteString -> IO ByteString -api = interpreter rootResolver -``` - -See [morpheus-graphql-examples](https://github.com/morpheusgraphql/morpheus-graphql) for more sophisticated APIs. - - -### Java - -#### [graphql-java](https://github.com/graphql-java/graphql-java) - -A Java library for building GraphQL APIs. - -Code that executes a hello world GraphQL query with `graphql-java`: - -```java -import graphql.ExecutionResult; -import graphql.GraphQL; -import graphql.schema.GraphQLSchema; -import graphql.schema.StaticDataFetcher; -import graphql.schema.idl.RuntimeWiring; -import graphql.schema.idl.SchemaGenerator; -import graphql.schema.idl.SchemaParser; -import graphql.schema.idl.TypeDefinitionRegistry; - -import static graphql.schema.idl.RuntimeWiring.newRuntimeWiring; - -public class HelloWorld { - - public static void main(String[] args) { - String schema = "type Query{hello: String} schema{query: Query}"; - - SchemaParser schemaParser = new SchemaParser(); - TypeDefinitionRegistry typeDefinitionRegistry = schemaParser.parse(schema); - - RuntimeWiring runtimeWiring = new RuntimeWiring() - .type("Query", builder -> builder.dataFetcher("hello", new StaticDataFetcher("world"))) - .build(); - - SchemaGenerator schemaGenerator = new SchemaGenerator(); - GraphQLSchema graphQLSchema = schemaGenerator.makeExecutableSchema(typeDefinitionRegistry, runtimeWiring); - - GraphQL build = GraphQL.newGraphQL(graphQLSchema).build(); - ExecutionResult executionResult = build.execute("{hello}"); - - System.out.println(executionResult.getData().toString()); - // Prints: {hello=world} - } -} -``` - -See [the graphql-java docs](https://github.com/graphql-java/graphql-java) for more information on setup. - -### JavaScript - -#### [GraphQL.js](/graphql-js/) ([github](https://github.com/graphql/graphql-js/)) ([npm](https://www.npmjs.com/package/graphql)) - -The reference implementation of the GraphQL specification, designed for running GraphQL in a Node.js environment. - -To run a `GraphQL.js` hello world script from the command line: - -```bash -npm install graphql -``` - -Then run `node hello.js` with this code in `hello.js`: - -```js -var { graphql, buildSchema } = require('graphql'); - -var schema = buildSchema(` - type Query { - hello: String - } -`); - -var root = { hello: () => 'Hello world!' }; - -graphql(schema, '{ hello }', root).then((response) => { - console.log(response); -}); -``` - -#### [express-graphql](/graphql-js/running-an-express-graphql-server/) ([github](https://github.com/graphql/express-graphql)) ([npm](https://www.npmjs.com/package/express-graphql)) - -The reference implementation of a GraphQL API server over an Express webserver. You can use this to run GraphQL in conjunction with a regular Express webserver, or as a standalone GraphQL server. - -To run an `express-graphql` hello world server: - -```bash -npm install express express-graphql graphql -``` - -Then run `node server.js` with this code in `server.js`: - -```js -var express = require('express'); -var { graphqlHTTP } = require('express-graphql'); -var { buildSchema } = require('graphql'); - -var schema = buildSchema(` - type Query { - hello: String - } -`); - -var root = { hello: () => 'Hello world!' }; - -var app = express(); -app.use('/graphql', graphqlHTTP({ - schema: schema, - rootValue: root, - graphiql: true, -})); -app.listen(4000, () => console.log('Now browse to localhost:4000/graphql')); -``` - -#### [apollo-server](https://www.apollographql.com/docs/apollo-server/) ([github](https://github.com/apollographql/apollo-server)) ([npm](https://www.npmjs.com/package/apollo-server-express)) - -A set of GraphQL server packages from Apollo that work with various Node.js HTTP frameworks (Express, Connect, Hapi, Koa etc). - -To run a hello world server with apollo-server-express: - -```bash -npm install apollo-server-express express -``` - -Then run `node server.js` with this code in `server.js`: - -```js -const express = require('express'); -const { ApolloServer, gql } = require('apollo-server-express'); - -const typeDefs = gql` - type Query { - hello: String - } -`; - -const resolvers = { - Query: { - hello: () => 'Hello world!', - }, -}; - -const server = new ApolloServer({ typeDefs, resolvers }); - -const app = express(); -server.applyMiddleware({ app }); - -app.listen({ port: 4000 }, () => - console.log('Now browse to http://localhost:4000' + server.graphqlPath) -); -``` - -Apollo Server also supports all Node.js HTTP server frameworks: Express, Connect, HAPI, Koa and NestJs. - -### Kotlin - - - [graphql-kotlin](https://github.com/ExpediaGroup/graphql-kotlin/): A set of libraries for running GraphQL server in Kotlin. - - [KGraphQL](https://github.com/aPureBase/KGraphQL): Pure Kotlin implementation to setup a GraphQL server. - -### Perl - - - [graphql-perl](https://github.com/graphql-perl/graphql-perl): A Perl port of GraphQL reference implementation - - [MetaCPAN documentation](https://metacpan.org/pod/GraphQL) - - [Mojolicious-Plugin-GraphQL](https://github.com/graphql-perl/Mojolicious-Plugin-GraphQL) - connect your GraphQL service to a Mojolicious app - - [GraphQL-Plugin-Convert-DBIC](https://github.com/graphql-perl/GraphQL-Plugin-Convert-DBIC) - automatically connect your DBIx::Class schema to GraphQL - - [GraphQL-Plugin-Convert-OpenAPI](https://github.com/graphql-perl/GraphQL-Plugin-Convert-OpenAPI) - automatically connect any OpenAPI service (either local Mojolicious one, or remote) to GraphQL - -### PHP - - - [graphql-php](https://github.com/webonyx/graphql-php): A PHP port of GraphQL reference implementation - - [graphql-relay-php](https://github.com/ivome/graphql-relay-php): A library to help construct a graphql-php server supporting react-relay. - - [Railt](https://github.com/railt/railt): A PHP GraphQL Framework. - - [Lighthouse](https://github.com/nuwave/lighthouse): A GraphQL server for Laravel - - [GraphQLBundle](https://github.com/overblog/GraphQLBundle): A GraphQL server for Symfony - - [WPGraphQL](https://github.com/wp-graphql/wp-graphql): A free, open-source WordPress plugin that provides an extendable GraphQL schema and API for any WordPress site - - [GraphQL API for WordPress](https://github.com/GraphQLAPI/graphql-api-for-wp): A GraphQL server for WordPress - - [GraPHPinator](https://github.com/infinityloop-dev/graphpinator): A GraphQL implementation for modern PHP - -#### [API Platform](https://api-platform.com) ([github](https://github.com/api-platform/api-platform)) - -API Platform is a fully-featured, flexible and extensible API framework built on top of Symfony. -The following class is enough to create both a Relay-compatible GraphQL server and a hypermedia API supporting modern REST formats (JSON-LD, JSONAPI...): - -```php -name; - } - // ... -} -``` - -Other GraphQLite features include validation, security, error handling, loading via data-loader pattern... - -#### [Siler](https://siler.leocavalcante.com/graphql/) ([github](https://github.com/leocavalcante/siler)) - -Siler is a PHP library powered with high-level abstractions to work with GraphQL. - -To run a Siler hello world script: - -```graphql -type Query { - hello: String -} -``` - -```php - [ - 'hello' => 'world', - ], -]; -$schema = Graphql\schema($typeDefs, $resolvers); - -echo "Server running at http://127.0.0.1:8080"; - -Http\server(Graphql\psr7($schema), function (\Throwable $err) { - var_dump($err); - return Diactoros\json([ - 'error' => true, - 'message' => $err->getMessage(), - ]); -})()->run(); -``` - -It also provides functionality for the construction of a WebSocket Subscriptions Server based on how Apollo works. - -### Swift - - - [Graphiti](https://github.com/GraphQLSwift/Graphiti): Swift library for building GraphQL schemas/types fast, safely and easily. - -### Python - -#### [Graphene](http://graphene-python.org/) ([github](https://github.com/graphql-python/graphene)) - -A Python library for building GraphQL APIs. - -To run a Graphene hello world script: - -```bash -pip install graphene -``` - -Then run `python hello.py` with this code in `hello.py`: - -```python -import graphene - -class Query(graphene.ObjectType): - hello = graphene.String(name=graphene.String(default_value="World")) - - def resolve_hello(self, info, name): - return 'Hello ' + name - -schema = graphene.Schema(query=Query) -result = schema.execute('{ hello }') -print(result.data['hello']) # "Hello World" -``` - -There are also nice bindings for [Relay](https://facebook.github.io/relay/), Django, SQLAlchemy, and Google App Engine. - -### Ruby - -#### [graphql-ruby](https://github.com/rmosolgo/graphql-ruby) - -A Ruby library for building GraphQL APIs. - -To run a hello world script with `graphql-ruby`: - -```bash -gem install graphql -``` - -Then run `ruby hello.rb` with this code in `hello.rb`: - -```ruby -require 'graphql' - -class QueryType < GraphQL::Schema::Object - graphql_name 'Query' - field :hello do - type types.String - resolve -> (obj, args, ctx) { 'Hello world!' } - end -end - -class Schema < GraphQL::Schema - query QueryType -end - -puts Schema.execute('{ hello }').to_json -``` - -There are also nice bindings for Relay and Rails. - -#### [Agoo](https://github.com/ohler55/agoo) - -A high performance web server with support for GraphQL. Agoo strives for a simple, easy to use API for GraphQL. - -```ruby -require 'agoo' - -class Query - def hello - 'hello' - end -end - -class Schema - attr_reader :query - - def initialize - @query = Query.new() - end -end - -Agoo::Server.init(6464, 'root', thread_count: 1, graphql: '/graphql') -Agoo::Server.start() -Agoo::GraphQL.schema(Schema.new) { - Agoo::GraphQL.load(%^type Query { hello: String }^) -} -sleep - -# To run this GraphQL example type the following then go to a browser and enter -# a URL of localhost:6464/graphql?query={hello} -# -# ruby hello.rb -``` - -### Rust - - - [graphql-rust/juniper](https://github.com/graphql-rust/juniper): GraphQL server library for Rust - -### Scala - -#### [Sangria](http://sangria-graphql.org/) ([github](https://github.com/sangria-graphql/sangria)): A Scala GraphQL library that supports [Relay](https://facebook.github.io/relay/). - -An example of a hello world GraphQL schema and query with `sangria`: - -```scala -import sangria.schema._ -import sangria.execution._ -import sangria.macros._ - -val QueryType = ObjectType("Query", fields[Unit, Unit]( - Field("hello", StringType, resolve = _ ⇒ "Hello world!") -)) - -val schema = Schema(QueryType) - -val query = graphql"{ hello }" - -Executor.execute(schema, query) map println -``` - -### OCaml / Reason - -#### [ocaml-graphql-server](https://github.com/andreas/ocaml-graphql-server): GraphQL server library for OCaml and Reason - -## GraphQL Clients - -- [C# / .NET](#c-net-1) -- [Clojurescript](#clojurescript-1) -- [Elixir](#elixir-1) -- [Elm](#elm) -- [Flutter](#flutter) -- [Go](#go-1) -- [Haskell](#haskell) -- [Java / Android](#java-android) -- [JavaScript](#javascript-1) -- [Julia](#julia) -- [Kotlin](#kotlin) -- [Swift / Objective-C iOS](#swift-objective-c-ios) -- [Python](#python-1) -- [R](#r) - -### C# / .NET - - - [GraphQL.Client](https://github.com/graphql-dotnet/graphql-client): A GraphQL Client for .NET. - - [graphql-net-client](https://github.com/bkniffler/graphql-net-client): Basic example GraphQL client for .NET. - - [SAHB.GraphQLClient](https://github.com/sahb1239/SAHB.GraphQLClient): GraphQL client which supports generating queries from C# classes - -### Clojurescript - - - [re-graph](https://github.com/oliyh/re-graph/): A GraphQL client implemented in Clojurescript with support for websockets. - -### Elixir - - - [Neuron](https://github.com/uesteibar/neuron): A GraphQL client for Elixir - - [common_graphql_client](https://github.com/annkissam/common_graphql_client): Elixir GraphQL Client with HTTP and WebSocket support - -### Elm - - - [dillonkearns/elm-graphql](https://github.com/dillonkearns/elm-graphql): Library and command-line code generator to create type-safe Elm code for a GraphQL endpoint. - -### Flutter - - - [graphql](https://github.com/zino-app/graphql-flutter#readme): A GraphQL client implementation in Flutter. - -### Go - - - [graphql](https://github.com/shurcooL/graphql#readme): A GraphQL client implementation in Go. - - [machinebox/graphql](https://github.com/machinebox/graphql): An elegant low-level HTTP client for GraphQL. - -### Haskell - - - [morpheus-graphql-client](https://github.com/morpheusgraphql/morpheus-graphql): A strongly-typed GraphQL client implementation in Haksell. - -### Java / Android - - - [Apollo Android](https://github.com/apollographql/apollo-android): A strongly-typed, caching GraphQL client for the JVM, Android and Kotlin native. - - - [Nodes](https://github.com/americanexpress/nodes): A GraphQL JVM Client designed for constructing queries from standard model definitions. By American Express. - -### JavaScript - - - [Relay](https://facebook.github.io/relay/) ([github](https://github.com/facebook/relay)) ([npm](https://www.npmjs.com/package/react-relay)): Facebook's framework for building React applications that talk to a GraphQL backend. - - [Apollo Client](http://apollographql.com/client/) ([github](https://github.com/apollographql/apollo-client)): A powerful JavaScript GraphQL client, designed to work well with React, React Native, Angular 2, or just plain JavaScript. - - [graphql-request](https://github.com/prisma/graphql-request): A simple and flexible JavaScript GraphQL client that works in all JavaScript environments (the browser, Node.js, and React Native) - basically a lightweight wrapper around `fetch`. - - [Lokka](https://github.com/kadirahq/lokka): A simple JavaScript GraphQL client that works in all JavaScript environments (the browser, Node.js, and React Native). - - [nanogql](https://github.com/yoshuawuyts/nanogql): Tiny GraphQL client library using template strings. - - [gq-loader](https://github.com/Houfeng/gq-loader): A simple JavaScript GraphQL client,Let the *.gql file be used as a module through webpack loader. - - [AWS Amplify](https://aws.github.io/aws-amplify): A JavaScript library for application development using cloud services, which supports GraphQL backend and React components for working with GraphQL data. - - [Grafoo](https://github.com/grafoojs/grafoo): An all purpose GraphQL client with view layer integrations for multiple frameworks in just 1.6kb. - - [urql](https://formidable.com/open-source/urql/) ([github](https://github.com/FormidableLabs/urql)): A highly customizable and versatile GraphQL client for React. - - [graphqurl](https://github.com/hasura/graphqurl) ([npm](https://www.npmjs.com/package/graphqurl)): curl for GraphQL with autocomplete, subscriptions and GraphiQL. Also a dead-simple universal javascript GraphQL client. - -### Julia - - - [Diana.jl](https://github.com/codeneomatrix/Diana.jl): A Julia GraphQL server implementation. - -### Kotlin - - - [graphql-kotlin](https://github.com/ExpediaGroup/graphql-kotlin/): A set of GraphQL libraries that includes a lightweight, typesafe GraphQL HTTP client. - -### Swift / Objective-C iOS - - - [Apollo iOS](https://www.apollographql.com/docs/ios/) ([github](https://github.com/apollographql/apollo-ios)): A GraphQL client for iOS that returns results as query-specific Swift types, and integrates with Xcode to show your Swift source and GraphQL side by side, with inline validation errors. - - [GraphQL iOS](https://github.com/funcompany/graphql-ios): An Objective-C GraphQL client for iOS. - - [Graphaello](https://github.com/nerdsupremacist/Graphaello): A Tool for Writing Declarative, Type-Safe and Data-Driven Applications in SwiftUI using GraphQL and Apollo - -### Python - - - [GQL](https://github.com/graphql-python/gql): A GraphQL client in Python. - - [python-graphql-client](https://github.com/prisma/python-graphql-client): Simple GraphQL client for Python 2.7+. - - [sgqlc](https://github.com/profusion/sgqlc): A simple Python GraphQL client. Supports generating code generation for types defined in a GraphQL schema. - -### R - - - [ghql](https://github.com/ropensci/ghql): General purpose GraphQL R client. - -## Tools - - - [graphiql](https://github.com/graphql/graphiql) ([npm](https://www.npmjs.com/package/graphiql)): An interactive in-browser GraphQL IDE. - - [libgraphqlparser](https://github.com/graphql/libgraphqlparser): A GraphQL query language parser in C++ with C and C++ APIs. - - [Graphql Language Service](https://github.com/graphql/graphql-language-service): An interface for building GraphQL language services for IDEs (diagnostics, autocomplete etc). - - [quicktype](https://quicktype.io) ([github](https://github.com/quicktype/quicktype)): Generate types for GraphQL queries in TypeScript, Swift, golang, C#, C++, and more. - - [GraphQL Code Generator](https://graphql-code-generator.com): GraphQL code generator with flexible support for custom plugins and templates like Typescript (frontend and backend), React Hooks, resolvers signatures and more. - - [GraphQL Inspector](https://www.graphql-inspector.com): Compare schemas, validate documents, find breaking changes, find similar types, schema coverage, and more. - - [GraphQL Config](https://www.graphql-config.com): One configuration for all your GraphQL tools (supported by most tools, editors & IDEs). - - [GraphQL CLI](https://www.graphql-cli.com): A command line tool for common GraphQL development workflows. - - [GraphQL Scalars](https://github.com/Urigo/graphql-scalars): A library of custom GraphQL scalar types for creating precise, type-safe GraphQL schemas. - - [GraphQL Tools](https://www.graphql-tools.com): A set of utils for faster development of GraphQL tools (Schema and documents loading, Schema merging and more). - - [SOFA](https://github.com/Urigo/sofa): Generate REST API from your GraphQL API. - - [GraphQL-ESLint](https://github.com/dotansimha/graphql-eslint): integrates GraphQL AST in the ESLint core (as a parser). - - [GraphQL Modules](https://www.graphql-modules.com): lets you separate your backend implementation to small, reusable, easy-to-implement and easy-to-test pieces. - - [GraphQL Mesh](https://www.graphql-mesh.com): allows you to use GraphQL query language to access data in remote APIs that don't run GraphQL (and also ones that do run GraphQL). It can be used as a gateway to other services, or run as a local GraphQL schema that aggregates data from remote APIs. - -## Services - - - [Apollo Graph Manager](https://engine.apollographql.com): A cloud service for monitoring the performance and usage of your GraphQL backend. - - [GraphCMS](https://graphcms.com/): A BaaS (Backend as a Service) that sets you up with a GraphQL backend as well as tools for content editors to work with the stored data. - - [Prisma](https://www.prisma.io) ([github](https://github.com/prisma)): A BaaS (Backend as a Service) providing a GraphQL backend for your applications with a powerful web ui for managing your database and stored data. - - [Tipe](https://tipe.io) ([github](https://github.com/tipeio)): A SaaS (Software as a Service) content management system that allows you to create your content with powerful editing tools and access it from anywhere with a GraphQL or REST API. - - [AWS AppSync](https://aws.amazon.com/appsync/): Fully managed GraphQL service with realtime subscriptions, offline programming & synchronization, and enterprise security features as well as fine grained authorization controls. - - [Elide](https://elide.io): A Java library that can expose a JPA annotated data model as a GraphQL service over any relational database. - - [Hasura](https://hasura.io) ([github](https://github.com/hasura)): Hasura connects to your databases & microservices and instantly gives you a production-ready GraphQL API. - - [FaunaDB](https://docs.fauna.com/fauna/current/graphql): Create an instant GraphQL backend by importing a gql schema. The database will create relations and indexes for you, so you'll be ready to query in seconds, without writing any database code. Serverless pricing, free to get started. - - [Back4App](https://www.back4app.com/docs/parse-graphql/graphql-getting-started): Back4App is a Backend as a Service Platform that helps you Build and Scale modern applications based on GraphQL. - -## More Stuff - - - [awesome-graphql](https://github.com/chentsulin/awesome-graphql): A fantastic community maintained collection of libraries, resources, and more. - diff --git a/src/content/code/language-support/c-c/tools/libgraphqlparser.md b/src/content/code/language-support/c-c/tools/libgraphqlparser.md new file mode 100644 index 0000000000..e3681c82fa --- /dev/null +++ b/src/content/code/language-support/c-c/tools/libgraphqlparser.md @@ -0,0 +1,8 @@ +--- +name: libgraphqlparser +description: A GraphQL query language parser in C++ with C and C++ APIs. +url: https://github.com/graphql/libgraphqlparser +github: graphql/libgraphqlparser +--- + + diff --git a/src/content/code/language-support/c-net/client/graphql-client.md b/src/content/code/language-support/c-net/client/graphql-client.md new file mode 100644 index 0000000000..df6e016432 --- /dev/null +++ b/src/content/code/language-support/c-net/client/graphql-client.md @@ -0,0 +1,8 @@ +--- +name: GraphQL.Client +description: A GraphQL Client for .NET. +url: https://github.com/graphql-dotnet/graphql-client +github: graphql-dotnet/graphql-client +--- + + diff --git a/src/content/code/language-support/c-net/client/graphql-net-client.md b/src/content/code/language-support/c-net/client/graphql-net-client.md new file mode 100644 index 0000000000..5042b5859c --- /dev/null +++ b/src/content/code/language-support/c-net/client/graphql-net-client.md @@ -0,0 +1,8 @@ +--- +name: graphql-net-client +description: Basic example GraphQL client for .NET. +url: https://github.com/bkniffler/graphql-net-client +github: bkniffler/graphql-net-client +--- + + diff --git a/src/content/code/language-support/c-net/client/sahb-graphqlclient.md b/src/content/code/language-support/c-net/client/sahb-graphqlclient.md new file mode 100644 index 0000000000..2fa58640f7 --- /dev/null +++ b/src/content/code/language-support/c-net/client/sahb-graphqlclient.md @@ -0,0 +1,8 @@ +--- +name: SAHB.GraphQLClient +description: GraphQL client which supports generating queries from C# classes +url: https://github.com/sahb1239/SAHB.GraphQLClient +github: sahb1239/SAHB.GraphQLClient +--- + + diff --git a/src/content/code/language-support/c-net/server/entity-graphql.md b/src/content/code/language-support/c-net/server/entity-graphql.md new file mode 100644 index 0000000000..be3cc954b3 --- /dev/null +++ b/src/content/code/language-support/c-net/server/entity-graphql.md @@ -0,0 +1,8 @@ +--- +name: Entity GraphQL +description: .NET Core GraphQL library. Compiles to IQueryable to easily expose a schema from an existing data model (E.g. from an Entity Framework data model) +url: https://github.com/lukemurray/EntityGraphQL +github: lukemurray/EntityGraphQL +--- + + diff --git a/src/content/code/language-support/c-net/server/graphql-dotnet.md b/src/content/code/language-support/c-net/server/graphql-dotnet.md new file mode 100644 index 0000000000..6ac2e840bb --- /dev/null +++ b/src/content/code/language-support/c-net/server/graphql-dotnet.md @@ -0,0 +1,34 @@ +--- +name: graphql-dotnet +description: GraphQL for .NET +url: https://github.com/graphql-dotnet/graphql-dotnet +github: graphql-dotnet/graphql-dotnet +--- + +```csharp +using System; +using System.Threading.Tasks; +using GraphQL; +using GraphQL.Types; +using GraphQL.SystemTextJson; // First add PackageReference to GraphQL.SystemTextJson + +public class Program +{ + public static async Task Main(string[] args) + { + var schema = Schema.For(@" + type Query { + hello: String + } + "); + + var json = await schema.ExecuteAsync(_ => + { + _.Query = "{ hello }"; + _.Root = new { Hello = "Hello World!" }; + }); + + Console.WriteLine(json); + } +} +``` diff --git a/src/content/code/language-support/c-net/server/graphql-net.md b/src/content/code/language-support/c-net/server/graphql-net.md new file mode 100644 index 0000000000..9c5d76e671 --- /dev/null +++ b/src/content/code/language-support/c-net/server/graphql-net.md @@ -0,0 +1,8 @@ +--- +name: graphql-net +description: Convert GraphQL to IQueryable +url: https://github.com/ckimes89/graphql-net +github: chkimes/graphql-net +--- + + diff --git a/src/content/code/language-support/c-net/server/hot-chocolate.md b/src/content/code/language-support/c-net/server/hot-chocolate.md new file mode 100644 index 0000000000..e762f13acc --- /dev/null +++ b/src/content/code/language-support/c-net/server/hot-chocolate.md @@ -0,0 +1,8 @@ +--- +name: Hot Chocolate +description: GraphQL Server for .NET core and .NET classic +url: https://github.com/ChilliCream/hotchocolate +github: ChilliCream/hotchocolate +--- + + diff --git a/src/content/code/language-support/clojure/client/regraph.md b/src/content/code/language-support/clojure/client/regraph.md new file mode 100644 index 0000000000..2c8b73838a --- /dev/null +++ b/src/content/code/language-support/clojure/client/regraph.md @@ -0,0 +1,8 @@ +--- +name: regraph +description: A GraphQL client implemented in Clojurescript with support for websockets. +url: https://github.com/oliyh/re-graph/ +github: oliyh/re-graph +--- + + diff --git a/src/content/code/language-support/clojure/server/alumbra.md b/src/content/code/language-support/clojure/server/alumbra.md new file mode 100644 index 0000000000..c652f0769a --- /dev/null +++ b/src/content/code/language-support/clojure/server/alumbra.md @@ -0,0 +1,41 @@ +--- +name: alumbra +description: A set of reusable GraphQL components for Clojure conforming to the data structures given in [alumbra.spec](https://github.com/alumbra/alumbra.spec). +url: https://github.com/alumbra/alumbra +github: alumbra/alumbra +--- + +```clojure +(require '[alumbra.core :as alumbra] + '[claro.data :as data]) + +(def schema + "type Person { name: String!, friends: [Person!]! } + type QueryRoot { person(id: ID!): Person, me: Person! } + schema { query: QueryRoot }") + +(defrecord Person [id] + data/Resolvable + (resolve! [_ _] + {:name (str "Person #" id) + :friends (map ->Person (range (inc id) (+ id 3)))})) + +(def QueryRoot + {:person (map->Person {}) + :me (map->Person {:id 0})}) + +(def app + (alumbra/handler + {:schema schema + :query QueryRoot})) + +(defonce my-graphql-server + (aleph.http/start-server #'app {:port 3000})) +``` + +```bash +$ curl -XPOST "http://0:3000" -H'Content-Type: application/json' -d'{ + "query": "{ me { name, friends { name } } }" +}' +{"data":{"me":{"name":"Person #0","friends":[{"name":"Person #1"},{"name":"Person #2"}]}}} +``` diff --git a/src/content/code/language-support/clojure/server/graphql-clj.md b/src/content/code/language-support/clojure/server/graphql-clj.md new file mode 100644 index 0000000000..e7baeea859 --- /dev/null +++ b/src/content/code/language-support/clojure/server/graphql-clj.md @@ -0,0 +1,23 @@ +--- +name: graphql-clj +description: A Clojure library that provides a GraphQL implementation. +url: https://github.com/tendant/graphql-clj +github: tendant/graphql-clj +--- + +Code that executes a hello world GraphQL query with `graphql-clj`: +```clojure + +(def schema "type QueryRoot { + hello: String + }") + +(defn resolver-fn [type-name field-name] + (get-in {"QueryRoot" {"hello" (fn [context parent & rest] + "Hello world!")}} + [type-name field-name])) + +(require '[graphql-clj.executor :as executor]) + +(executor/execute nil schema resolver-fn "{ hello }") +``` diff --git a/src/content/code/language-support/clojure/server/lacinia.md b/src/content/code/language-support/clojure/server/lacinia.md new file mode 100644 index 0000000000..0bb3f22aed --- /dev/null +++ b/src/content/code/language-support/clojure/server/lacinia.md @@ -0,0 +1,8 @@ +--- +name: lacinia +description: A full implementation of the GraphQL specification that aims to maintain external compliance with the specification. +url: https://github.com/walmartlabs/lacinia +github: walmartlabs/lacinia +--- + + diff --git a/src/content/code/language-support/d/server/graphqld.md b/src/content/code/language-support/d/server/graphqld.md new file mode 100644 index 0000000000..da50567414 --- /dev/null +++ b/src/content/code/language-support/d/server/graphqld.md @@ -0,0 +1,8 @@ +--- +name: graphqld +description: A GraphQL implementaiton for the D Programming Language. +url: https://github.com/burner/graphqld +github: burner/graphqld +--- + + diff --git a/src/content/code/language-support/elixir/client/common-graphql-client.md b/src/content/code/language-support/elixir/client/common-graphql-client.md new file mode 100644 index 0000000000..ec360e651f --- /dev/null +++ b/src/content/code/language-support/elixir/client/common-graphql-client.md @@ -0,0 +1,8 @@ +--- +name: common_graphql_client +description: Elixir GraphQL Client with HTTP and WebSocket support +url: https://github.com/annkissam/common_graphql_client +github: annkissam/common_graphql_client +--- + + diff --git a/src/content/code/language-support/elixir/client/neuron.md b/src/content/code/language-support/elixir/client/neuron.md new file mode 100644 index 0000000000..c77f230742 --- /dev/null +++ b/src/content/code/language-support/elixir/client/neuron.md @@ -0,0 +1,8 @@ +--- +name: Neuron +description: A GraphQL client for Elixir +url: https://github.com/uesteibar/neuron +github: uesteibar/neuron +--- + + diff --git a/src/content/code/language-support/elixir/server/absinthe.md b/src/content/code/language-support/elixir/server/absinthe.md new file mode 100644 index 0000000000..bc657a90b8 --- /dev/null +++ b/src/content/code/language-support/elixir/server/absinthe.md @@ -0,0 +1,8 @@ +--- +name: absinthe +description: GraphQL implementation for Elixir. +url: https://github.com/absinthe-graphql/absinthe +github: absinthe-graphql/absinthe +--- + + diff --git a/src/content/code/language-support/elixir/server/graphql-elixir.md b/src/content/code/language-support/elixir/server/graphql-elixir.md new file mode 100644 index 0000000000..4ec2bf84b1 --- /dev/null +++ b/src/content/code/language-support/elixir/server/graphql-elixir.md @@ -0,0 +1,8 @@ +--- +name: graphql-elixir +description: An Elixir implementation of Facebook's GraphQL. +url: https://github.com/graphql-elixir/graphql +github: graphql-elixir/graphql +--- + + diff --git a/src/content/code/language-support/elm/client/dillonkearns-elm-graphql.md b/src/content/code/language-support/elm/client/dillonkearns-elm-graphql.md new file mode 100644 index 0000000000..0850dba825 --- /dev/null +++ b/src/content/code/language-support/elm/client/dillonkearns-elm-graphql.md @@ -0,0 +1,8 @@ +--- +name: dillonkearns/elm-graphql +description: Library and command-line code generator to create type-safe Elm code for a GraphQL endpoint. +url: https://github.com/dillonkearns/elm-graphql +github: dillonkearns/elm-graphql +--- + + diff --git a/src/content/code/language-support/erlang/server/graphql-erlang.md b/src/content/code/language-support/erlang/server/graphql-erlang.md new file mode 100644 index 0000000000..9bb34ad549 --- /dev/null +++ b/src/content/code/language-support/erlang/server/graphql-erlang.md @@ -0,0 +1,8 @@ +--- +name: graphql-erlang +description: GraphQL implementation in Erlang. +url: https://github.com/shopgun/graphql-erlang +github: jlouis/graphql-erlang +--- + + diff --git a/src/content/code/language-support/flutter/client/graphql.md b/src/content/code/language-support/flutter/client/graphql.md new file mode 100644 index 0000000000..fa0eb8e3aa --- /dev/null +++ b/src/content/code/language-support/flutter/client/graphql.md @@ -0,0 +1,8 @@ +--- +name: graphql +description: A GraphQL client implementation in Flutter. +url: https://github.com/zino-app/graphql-flutter#readme +github: zino-app/graphql-flutter +--- + + diff --git a/src/content/code/language-support/go/client/graphql.md b/src/content/code/language-support/go/client/graphql.md new file mode 100644 index 0000000000..3e778eac5d --- /dev/null +++ b/src/content/code/language-support/go/client/graphql.md @@ -0,0 +1,8 @@ +--- +name: graphql +description: A GraphQL client implementation in Go. +url: https://github.com/shurcooL/graphql#readme +github: shurcooL/graphql +--- + + diff --git a/src/content/code/language-support/go/client/machinebox-graphql.md b/src/content/code/language-support/go/client/machinebox-graphql.md new file mode 100644 index 0000000000..a2f35489d8 --- /dev/null +++ b/src/content/code/language-support/go/client/machinebox-graphql.md @@ -0,0 +1,8 @@ +--- +name: machinebox/graphql +description: An elegant low-level HTTP client for GraphQL. +url: https://github.com/machinebox/graphql +github: machinebox/graphql +--- + + diff --git a/src/content/code/language-support/go/server/99designs-gqlgen.md b/src/content/code/language-support/go/server/99designs-gqlgen.md new file mode 100644 index 0000000000..80b2f9d0f2 --- /dev/null +++ b/src/content/code/language-support/go/server/99designs-gqlgen.md @@ -0,0 +1,8 @@ +--- +name: 99designs/gqlgen +description: Go generate based graphql server library. +url: https://github.com/99designs/gqlgen +github: 99designs/gqlgen +--- + + diff --git a/src/content/code/language-support/go/server/appointy-jaal.md b/src/content/code/language-support/go/server/appointy-jaal.md new file mode 100644 index 0000000000..28095e284e --- /dev/null +++ b/src/content/code/language-support/go/server/appointy-jaal.md @@ -0,0 +1,8 @@ +--- +name: appointy/jaal +description: Develop spec compliant GraphQL servers in Go. +url: https://github.com/appointy/jaal +github: appointy/jaal +--- + + diff --git a/src/content/code/language-support/go/server/graph-gophers-graphql-go.md b/src/content/code/language-support/go/server/graph-gophers-graphql-go.md new file mode 100644 index 0000000000..2bf5eaad94 --- /dev/null +++ b/src/content/code/language-support/go/server/graph-gophers-graphql-go.md @@ -0,0 +1,8 @@ +--- +name: graph-gophers/graphql-go +description: An active implementation of GraphQL in Golang (was https://github.com/neelance/graphql-go). +url: https://github.com/graph-gophers/graphql-go +github: graph-gophers/graphql-go +--- + + diff --git a/src/content/code/language-support/go/server/graphql-go.md b/src/content/code/language-support/go/server/graphql-go.md new file mode 100644 index 0000000000..6ef7da936f --- /dev/null +++ b/src/content/code/language-support/go/server/graphql-go.md @@ -0,0 +1,8 @@ +--- +name: graphql-go +description: An implementation of GraphQL for Go / Golang. +url: https://github.com/graphql-go/graphql +github: graphql-go/graphql +--- + + diff --git a/src/content/code/language-support/go/server/graphql-relay-go.md b/src/content/code/language-support/go/server/graphql-relay-go.md new file mode 100644 index 0000000000..423b01719d --- /dev/null +++ b/src/content/code/language-support/go/server/graphql-relay-go.md @@ -0,0 +1,8 @@ +--- +name: graphql-relay-go +description: A Go/Golang library to help construct a graphql-go server supporting react-relay. +url: https://github.com/graphql-go/relay +github: graphql-go/relay +--- + + diff --git a/src/content/code/language-support/go/server/samsarahq-thunder.md b/src/content/code/language-support/go/server/samsarahq-thunder.md new file mode 100644 index 0000000000..370cd634e2 --- /dev/null +++ b/src/content/code/language-support/go/server/samsarahq-thunder.md @@ -0,0 +1,8 @@ +--- +name: samsarahq/thunder +description: A GraphQL implementation with easy schema building, live queries, and batching. +url: https://github.com/samsarahq/thunder +github: samsarahq/thunder +--- + + diff --git a/src/content/code/language-support/go/tools/super-graph.md b/src/content/code/language-support/go/tools/super-graph.md new file mode 100644 index 0000000000..404e585991 --- /dev/null +++ b/src/content/code/language-support/go/tools/super-graph.md @@ -0,0 +1,8 @@ +--- +name: super-graph +description: An instant GraphQL to SQL compiler. Use as a standalone service or a Go library +url: https://github.com/dosco/super-graph +github: dosco/super-graph +--- + + diff --git a/src/content/code/language-support/groovy/server/gorm-graphql.md b/src/content/code/language-support/groovy/server/gorm-graphql.md new file mode 100644 index 0000000000..9c6ba9c890 --- /dev/null +++ b/src/content/code/language-support/groovy/server/gorm-graphql.md @@ -0,0 +1,21 @@ +--- +name: gorm-graphql +description: An automatic GraphQL schema generator for GORM +url: https://grails.github.io/gorm-graphql/latest/guide/index.html +github: grails/gorm-graphql +--- + +**Core Library** - The GORM GraphQL library provides functionality to generate a GraphQL schema based on your GORM entities. In addition to mapping domain classes to a GraphQL schema, the core library also provides default implementations of "data fetchers" to query, update, and delete data through executions of the schema. + +**Grails Plugin** - In a addition to the Core Library, the GORM GraphQL Grails Plugin: + +- Provides a controller to receive and respond to GraphQL requests through HTTP, based on their guidelines. + +- Generates the schema at startup with spring bean configuration to make it easy to extend. + +- Includes a [GraphiQL](https://github.com/graphql/graphiql) browser enabled by default in development. The browser is accessible at /graphql/browser. + +- Overrides the default data binder to use the data binding provided by Grails +- Provides a [trait](https://grails.github.io/gorm-graphql/latest/api/org/grails/gorm/graphql/plugin/testing/GraphQLSpec.html) to make integration testing of your GraphQL endpoints easier + +See [the documentation](https://grails.github.io/gorm-graphql/latest/guide/index.html) for more information. diff --git a/src/content/code/language-support/groovy/server/gql.md b/src/content/code/language-support/groovy/server/gql.md new file mode 100644 index 0000000000..fa32e99e5a --- /dev/null +++ b/src/content/code/language-support/groovy/server/gql.md @@ -0,0 +1,8 @@ +--- +name: GQL +description: GQL is a Groove library for GraphQL +url: https://grooviter.github.io/gql/ +github: grooviter/gql +--- + + diff --git a/src/content/code/language-support/haskell/client/morpheus-graphql-client.md b/src/content/code/language-support/haskell/client/morpheus-graphql-client.md new file mode 100644 index 0000000000..cec77a5e8e --- /dev/null +++ b/src/content/code/language-support/haskell/client/morpheus-graphql-client.md @@ -0,0 +1,8 @@ +--- +name: morpheus-graphql-client +description: A strongly-typed GraphQL client implementation in Haksell. +url: https://github.com/morpheusgraphql/morpheus-graphql +github: morpheusgraphql/morpheus-graphql +--- + + diff --git a/src/content/code/language-support/haskell/server/morpheus-graphql.md b/src/content/code/language-support/haskell/server/morpheus-graphql.md new file mode 100644 index 0000000000..a53e7216ea --- /dev/null +++ b/src/content/code/language-support/haskell/server/morpheus-graphql.md @@ -0,0 +1,61 @@ +--- +name: Morpheus GraphQL +description: A Haskell library for building GraphQL APIs. +url: https://github.com/morpheusgraphql/morpheus-graphql +github: morpheusgraphql/morpheus-graphql +--- + +Hello world example with `morpheus-graphql`: + +```graphql +# schema.gql +""" +A supernatural being considered divine and sacred +""" +type Deity { + name: String! + power: String @deprecated(reason: "no more supported") +} +type Query { + deity(name: String! = "Morpheus"): Deity! +} +``` + + +```haskell +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE DuplicateRecordFields #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE NamedFieldPuns #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE TypeFamilies #-} +module API (api) where +import Data.ByteString.Lazy.Char8 (ByteString) +import Data.Morpheus (interpreter) +import Data.Morpheus.Document (importGQLDocument) +import Data.Morpheus.Types (RootResolver (..), Undefined (..)) +import Data.Text (Text) +importGQLDocument "schema.gql" +rootResolver :: RootResolver IO () Query Undefined Undefined +rootResolver = + RootResolver + { queryResolver = Query {deity}, + mutationResolver = Undefined, + subscriptionResolver = Undefined + } + where + deity DeityArgs {name} = + pure + Deity + { name = pure name, + power = pure (Just "Shapeshifting") + } +api :: ByteString -> IO ByteString +api = interpreter rootResolver +``` + +See [morpheus-graphql-examples](https://github.com/morpheusgraphql/morpheus-graphql) for more sophisticated APIs. diff --git a/src/content/code/language-support/java-kotlin-android/client/apollo-android.md b/src/content/code/language-support/java-kotlin-android/client/apollo-android.md new file mode 100644 index 0000000000..d4e6fc704e --- /dev/null +++ b/src/content/code/language-support/java-kotlin-android/client/apollo-android.md @@ -0,0 +1,8 @@ +--- +name: Apollo Android +description: A strongly-typed, caching GraphQL client for Android, written in Java. +url: https://github.com/apollographql/apollo-android +github: apollographql/apollo-android +--- + + diff --git a/src/content/code/language-support/java-kotlin-android/client/nodes.md b/src/content/code/language-support/java-kotlin-android/client/nodes.md new file mode 100644 index 0000000000..2840e6a29a --- /dev/null +++ b/src/content/code/language-support/java-kotlin-android/client/nodes.md @@ -0,0 +1,8 @@ +--- +name: Nodes +description: A GraphQL JVM Client designed for constructing queries from standard model definitions. By American Express. +url: https://github.com/americanexpress/nodes +github: americanexpress/nodes +--- + + diff --git a/src/content/code/language-support/java-kotlin-android/server/graphql-java.md b/src/content/code/language-support/java-kotlin-android/server/graphql-java.md new file mode 100644 index 0000000000..d01ea20a88 --- /dev/null +++ b/src/content/code/language-support/java-kotlin-android/server/graphql-java.md @@ -0,0 +1,47 @@ +--- +name: graphql-java +description: A Java library for building GraphQL APIs. +url: https://github.com/graphql-java/graphql-java +github: graphql-java/graphql-java +--- + +Code that executes a hello world GraphQL query with `graphql-java`: + +```java +import graphql.ExecutionResult; +import graphql.GraphQL; +import graphql.schema.GraphQLSchema; +import graphql.schema.StaticDataFetcher; +import graphql.schema.idl.RuntimeWiring; +import graphql.schema.idl.SchemaGenerator; +import graphql.schema.idl.SchemaParser; +import graphql.schema.idl.TypeDefinitionRegistry; + +import static graphql.schema.idl.RuntimeWiring.newRuntimeWiring; + +public class HelloWorld { + + public static void main(String[] args) { + String schema = "type Query{hello: String} schema{query: Query}"; + + SchemaParser schemaParser = new SchemaParser(); + TypeDefinitionRegistry typeDefinitionRegistry = schemaParser.parse(schema); + + RuntimeWiring runtimeWiring = new RuntimeWiring() + .type("Query", builder -> builder.dataFetcher("hello", new StaticDataFetcher("world"))) + .build(); + + SchemaGenerator schemaGenerator = new SchemaGenerator(); + GraphQLSchema graphQLSchema = schemaGenerator.makeExecutableSchema(typeDefinitionRegistry, runtimeWiring); + + GraphQL build = GraphQL.newGraphQL(graphQLSchema).build(); + ExecutionResult executionResult = build.execute("{hello}"); + + System.out.println(executionResult.getData().toString()); + // Prints: {hello=world} + } +} +``` + +See [the graphql-java docs](https://github.com/graphql-java/graphql-java) for more information on setup. + diff --git a/src/content/code/language-support/java-kotlin-android/server/graphql-kotlin.md b/src/content/code/language-support/java-kotlin-android/server/graphql-kotlin.md new file mode 100644 index 0000000000..d2ac52b9b2 --- /dev/null +++ b/src/content/code/language-support/java-kotlin-android/server/graphql-kotlin.md @@ -0,0 +1,8 @@ +--- +name: graphql-kotlin +description: A set of libraries for running GraphQL server in Kotlin. +url: https://github.com/ExpediaGroup/graphql-kotlin/ +github: ExpediaGroup/graphql-kotlin +--- + + diff --git a/src/content/code/language-support/java-kotlin-android/tools/graphql-java-generator.md b/src/content/code/language-support/java-kotlin-android/tools/graphql-java-generator.md new file mode 100644 index 0000000000..04f6855ad0 --- /dev/null +++ b/src/content/code/language-support/java-kotlin-android/tools/graphql-java-generator.md @@ -0,0 +1,16 @@ +--- +name: GraphQL Java Generator +description: GraphQL Java Generator is a tool that generates Java code to speed up development for Client and Server of GraphQL APIs +url: https://github.com/graphql-java-generator +github: graphql-java-generator/graphql-gradle-plugin-project +--- + +* GraphQL Java client: it generates the Java classes that call the GraphQL endpoint, and the POJO that will contain the data returned by the server. +The GraphQL endpoint can then be queried by using a simple call to a Java method (see sample below) +* GraphQL Java server: it is based on [graphql-java](https://github.com/graphql-java/graphql-java) (listed here above). It generates all the boilerplate code. +You'll only have to implement what's specific to your server, which are the joins between the GraphQL types. +GraphQL Java Generator is available as a [Maven Plugin](https://graphql-maven-plugin-project.graphql-java-generator.com/index.html). +A Gradle plugin is coming soon. +Please note that GraphQL Java Generator is an accelerator: the generated code doesn’t depend on any library specific to GraphQL Java Generator. +So, it helps you to start building application based on graphql-java. Once the code is generated, you can decide to manually edit it as any standard java application, and get rid of GraphQL Java Generator. +Of course you can, and should, according to us :), continue using GraphQL Java Generator when your projet evolves. diff --git a/src/content/code/language-support/javascript/client/apollo-client.md b/src/content/code/language-support/javascript/client/apollo-client.md new file mode 100644 index 0000000000..2de76d9c45 --- /dev/null +++ b/src/content/code/language-support/javascript/client/apollo-client.md @@ -0,0 +1,9 @@ +--- +name: Apollo Client +description: A powerful JavaScript GraphQL client, designed to work well with React, React Native, Angular 2, or just plain JavaScript. +url: http://apollographql.com/client/ +github: apollographql/apollo-client +npm: "@apollo/client" +--- + + diff --git a/src/content/code/language-support/javascript/client/aws-amplify.md b/src/content/code/language-support/javascript/client/aws-amplify.md new file mode 100644 index 0000000000..1588f72758 --- /dev/null +++ b/src/content/code/language-support/javascript/client/aws-amplify.md @@ -0,0 +1,9 @@ +--- +name: AWS Amplify +description: A JavaScript library for application development using cloud services, which supports GraphQL backend and React components for working with GraphQL data. +url: https://docs.amplify.aws/ +github: aws-amplify/amplify-js +npm: "aws-amplify" +--- + + diff --git a/src/content/code/language-support/javascript/client/gq-loader.md b/src/content/code/language-support/javascript/client/gq-loader.md new file mode 100644 index 0000000000..40a76b1b1a --- /dev/null +++ b/src/content/code/language-support/javascript/client/gq-loader.md @@ -0,0 +1,9 @@ +--- +name: gq-loader +description: A simple JavaScript GraphQL client,Let the *.gql file be used as a module through webpack loader. +url: https://github.com/Houfeng/gq-loader +github: Houfeng/gq-loader +npm: "gq-loader" +--- + + diff --git a/src/content/code/language-support/javascript/client/grafoo.md b/src/content/code/language-support/javascript/client/grafoo.md new file mode 100644 index 0000000000..792facaee3 --- /dev/null +++ b/src/content/code/language-support/javascript/client/grafoo.md @@ -0,0 +1,9 @@ +--- +name: Grafoo +description: An all purpose GraphQL client with view layer integrations for multiple frameworks in just 1.6kb. +url: https://github.com/grafoojs/grafoo +github: grafoojs/grafoo +npm: "@grafoo/core" +--- + + diff --git a/src/content/code/language-support/javascript/client/graphql-request.md b/src/content/code/language-support/javascript/client/graphql-request.md new file mode 100644 index 0000000000..12e6d10d25 --- /dev/null +++ b/src/content/code/language-support/javascript/client/graphql-request.md @@ -0,0 +1,9 @@ +--- +name: GraphQL Request +description: A simple and flexible JavaScript GraphQL client that works in all JavaScript environments (the browser, Node.js, and React Native) - basically a lightweight wrapper around `fetch`. +url: https://github.com/prisma/graphql-request +github: prisma-labs/graphql-request +npm: "graphql-request" +--- + + diff --git a/src/content/code/language-support/javascript/client/graphqurl.md b/src/content/code/language-support/javascript/client/graphqurl.md new file mode 100644 index 0000000000..8d9b83db99 --- /dev/null +++ b/src/content/code/language-support/javascript/client/graphqurl.md @@ -0,0 +1,9 @@ +--- +name: graphqurl +description: curl for GraphQL with autocomplete, subscriptions and GraphiQL. Also a dead-simple universal javascript GraphQL client. +url: https://github.com/hasura/graphqurl +github: hasura/graphqurl +npm: "graphqurl" +--- + + diff --git a/src/content/code/language-support/javascript/client/lokka.md b/src/content/code/language-support/javascript/client/lokka.md new file mode 100644 index 0000000000..6f3c8d3277 --- /dev/null +++ b/src/content/code/language-support/javascript/client/lokka.md @@ -0,0 +1,9 @@ +--- +name: Lokka +description: A simple JavaScript GraphQL client that works in all JavaScript environments (the browser, Node.js, and React Native). +url: https://github.com/kadirahq/lokka +github: kadirahq/lokka +npm: "lokka" +--- + + diff --git a/src/content/code/language-support/javascript/client/nanogql.md b/src/content/code/language-support/javascript/client/nanogql.md new file mode 100644 index 0000000000..14e6761774 --- /dev/null +++ b/src/content/code/language-support/javascript/client/nanogql.md @@ -0,0 +1,9 @@ +--- +name: nanogql +description: Tiny GraphQL client library using template strings. +url: https://github.com/yoshuawuyts/nanogql +github: choojs/nanographql +npm: "nanographql" +--- + + diff --git a/src/content/code/language-support/javascript/client/relay.md b/src/content/code/language-support/javascript/client/relay.md new file mode 100644 index 0000000000..ea2d96a16d --- /dev/null +++ b/src/content/code/language-support/javascript/client/relay.md @@ -0,0 +1,9 @@ +--- +name: Relay +description: Facebook's framework for building React applications that talk to a GraphQL backend. +url: https://facebook.github.io/relay/ +github: facebook/relay +npm: "react-relay" +--- + + diff --git a/src/content/code/language-support/javascript/client/urql.md b/src/content/code/language-support/javascript/client/urql.md new file mode 100644 index 0000000000..2dcc709cc5 --- /dev/null +++ b/src/content/code/language-support/javascript/client/urql.md @@ -0,0 +1,9 @@ +--- +name: urql +description: A highly customizable and versatile GraphQL client for React. +url: https://formidable.com/open-source/urql/ +github: FormidableLabs/urql +npm: "urql" +--- + + diff --git a/src/content/code/language-support/javascript/server/apollo-server.md b/src/content/code/language-support/javascript/server/apollo-server.md new file mode 100644 index 0000000000..de749042b6 --- /dev/null +++ b/src/content/code/language-support/javascript/server/apollo-server.md @@ -0,0 +1,43 @@ +--- +name: Apollo Server +description: A set of GraphQL server packages from Apollo that work with various Node.js HTTP frameworks (Express, Connect, Hapi, Koa etc). +url: https://www.apollographql.com/docs/apollo-server/ +github: apollographql/apollo-server +npm: "apollo-server-express" +--- + +To run a hello world server with apollo-server-express: + +```bash +npm install apollo-server-express express +``` + +Then run `node server.js` with this code in `server.js`: + +```js +const express = require('express'); +const { ApolloServer, gql } = require('apollo-server-express'); + +const typeDefs = gql` + type Query { + hello: String + } +`; + +const resolvers = { + Query: { + hello: () => 'Hello world!', + }, +}; + +const server = new ApolloServer({ typeDefs, resolvers }); + +const app = express(); +server.applyMiddleware({ app }); + +app.listen({ port: 4000 }, () => + console.log('Now browse to http://localhost:4000' + server.graphqlPath) +); +``` + +Apollo Server also supports all Node.js HTTP server frameworks: Express, Connect, HAPI, Koa and NestJs. diff --git a/src/content/code/language-support/javascript/server/express-graphql.md b/src/content/code/language-support/javascript/server/express-graphql.md new file mode 100644 index 0000000000..ae70681236 --- /dev/null +++ b/src/content/code/language-support/javascript/server/express-graphql.md @@ -0,0 +1,37 @@ +--- +name: Express GraphQL +description: The reference implementation of a GraphQL API server over an Express webserver. You can use this to run GraphQL in conjunction with a regular Express webserver, or as a standalone GraphQL server. +url: /graphql-js/running-an-express-graphql-server/ +github: graphql/express-graphql +npm: "express-graphql" +--- + +To run an `express-graphql` hello world server: + +```bash +npm install express express-graphql graphql +``` + +Then run `node server.js` with this code in `server.js`: + +```js +var express = require('express'); +var { graphqlHTTP } = require('express-graphql'); +var { buildSchema } = require('graphql'); + +var schema = buildSchema(` + type Query { + hello: String + } +`); + +var root = { hello: () => 'Hello world!' }; + +var app = express(); +app.use('/graphql', graphqlHTTP({ + schema: schema, + rootValue: root, + graphiql: true, +})); +app.listen(4000, () => console.log('Now browse to localhost:4000/graphql')); +``` diff --git a/src/content/code/language-support/javascript/server/graphql-helix.md b/src/content/code/language-support/javascript/server/graphql-helix.md new file mode 100644 index 0000000000..ed9b8c1bb1 --- /dev/null +++ b/src/content/code/language-support/javascript/server/graphql-helix.md @@ -0,0 +1,9 @@ +--- +name: GraphQL Helix +description: A collection of utility functions for building your own GraphQL HTTP server. You can check out [Building a GraphQL server with GraphQL Helix](https://dev.to/danielrearden/building-a-graphql-server-with-graphql-helix-2k44) on DEV for a detailed tutorial on getting started. +url: https://github.com/contrawork/graphql-helix +github: contrawork/graphql-helix +npm: "graphql-helix" +--- + + diff --git a/src/content/code/language-support/javascript/server/graphql-js.md b/src/content/code/language-support/javascript/server/graphql-js.md new file mode 100644 index 0000000000..9769b78e39 --- /dev/null +++ b/src/content/code/language-support/javascript/server/graphql-js.md @@ -0,0 +1,31 @@ +--- +name: GraphQL.js +description: The reference implementation of the GraphQL specification, designed for running GraphQL in a Node.js environment. +url: /graphql-js/ +github: graphql/graphql-js +npm: "graphql" +--- + +To run a `GraphQL.js` hello world script from the command line: + +```bash +npm install graphql +``` + +Then run `node hello.js` with this code in `hello.js`: + +```js +var { graphql, buildSchema } = require('graphql'); + +var schema = buildSchema(` + type Query { + hello: String + } +`); + +var root = { hello: () => 'Hello world!' }; + +graphql(schema, '{ hello }', root).then((response) => { + console.log(response); +}); +``` diff --git a/src/content/code/language-support/javascript/server/graphql-yoga.md b/src/content/code/language-support/javascript/server/graphql-yoga.md new file mode 100644 index 0000000000..7cac87710a --- /dev/null +++ b/src/content/code/language-support/javascript/server/graphql-yoga.md @@ -0,0 +1,37 @@ +--- +name: graphql-yoga +description: Fully-featured GraphQL Server with focus on easy setup, performance & great developer experience +url: https://github.com/prisma-labs/graphql-yoga +github: prisma-labs/graphql-yoga +npm: "graphql-yoga" +--- + +- Sensible defaults & includes everything you need with minimal setup. +- Built-in support for GraphQL subscriptions using WebSockets. +- Works with all GraphQL clients (Apollo, Relay...) and fits seamless in your GraphQL workflow. + +To run a hello world server with graphql-yoga: + +```bash +npm install graphql-yoga +``` + +Then run `node server.js` with this code in `server.js`: + +```js +import { GraphQLServer } from 'graphql-yoga' +// ... or using "require()" +// const { GraphQLServer } = require('graphql-yoga') +const typeDefs = ` + type Query { + hello(name: String): String! + } +`; +const resolvers = { + Query: { + hello: (_, { name }) => `Hello ${name || 'World'}`, + }, +}; +const server = new GraphQLServer({ typeDefs, resolvers }) +server.start(() => console.log('Server is running on localhost:4000')) +``` diff --git a/src/content/code/language-support/javascript/tools/graphiql.md b/src/content/code/language-support/javascript/tools/graphiql.md new file mode 100644 index 0000000000..b9c2b53ffe --- /dev/null +++ b/src/content/code/language-support/javascript/tools/graphiql.md @@ -0,0 +1,9 @@ +--- +name: GraphiQL +description: An interactive in-browser GraphQL IDE. +url: https://github.com/graphql/graphiql +github: graphql/graphiql +npm: "graphiql" +--- + + diff --git a/src/content/code/language-support/javascript/tools/graphql-cli.md b/src/content/code/language-support/javascript/tools/graphql-cli.md new file mode 100644 index 0000000000..3c7ff98d00 --- /dev/null +++ b/src/content/code/language-support/javascript/tools/graphql-cli.md @@ -0,0 +1,9 @@ +--- +name: GraphQL CLI +description: A command line tool for common GraphQL development workflows. +url: https://graphql-cli.com +github: Urigo/graphql-cli +npm: "graphql-cli" +--- + + diff --git a/src/content/code/language-support/javascript/tools/graphql-code-generator.md b/src/content/code/language-support/javascript/tools/graphql-code-generator.md new file mode 100644 index 0000000000..ac5bf4fed5 --- /dev/null +++ b/src/content/code/language-support/javascript/tools/graphql-code-generator.md @@ -0,0 +1,9 @@ +--- +name: GraphQL Code Generator +description: GraphQL code generator with flexible support for custom plugins and templates like Typescript (frontend and backend), React Hooks, resolvers signatures and more. +url: https://graphql-code-generator.com +github: dotansimha/graphql-code-generator +npm: "@graphql-codegen/cli" +--- + + diff --git a/src/content/code/language-support/javascript/tools/graphql-config.md b/src/content/code/language-support/javascript/tools/graphql-config.md new file mode 100644 index 0000000000..8bc7db8659 --- /dev/null +++ b/src/content/code/language-support/javascript/tools/graphql-config.md @@ -0,0 +1,9 @@ +--- +name: GraphQL Config +description: One configuration for all your GraphQL tools (supported by most tools, editors & IDEs). +url: https://graphql-config.com +github: kamilkisiela/graphql-config +npm: "graphql-config" +--- + + diff --git a/src/content/code/language-support/javascript/tools/graphql-eslint.md b/src/content/code/language-support/javascript/tools/graphql-eslint.md new file mode 100644 index 0000000000..829e4c62eb --- /dev/null +++ b/src/content/code/language-support/javascript/tools/graphql-eslint.md @@ -0,0 +1,9 @@ +--- +name: GraphQL-ESLint +description: GraphQL-ESLint integrates GraphQL AST in the ESLint core (as a parser). +url: https://github.com/dotansimha/graphql-eslint/ +github: dotansimha/graphql-eslint/ +npm: "@graphql-eslint/eslint-plugin" +--- + + diff --git a/src/content/code/language-support/javascript/tools/graphql-inspector.md b/src/content/code/language-support/javascript/tools/graphql-inspector.md new file mode 100644 index 0000000000..060c06929f --- /dev/null +++ b/src/content/code/language-support/javascript/tools/graphql-inspector.md @@ -0,0 +1,9 @@ +--- +name: GraphQL Inspector +description: Compare schemas, validate documents, find breaking changes, find similar types, schema coverage, and more. +url: https://graphql-inspector.com/ +github: kamilkisiela/graphql-inspector +npm: "@graphql-inspector/cli" +--- + + diff --git a/src/content/code/language-support/javascript/tools/graphql-language-service.md b/src/content/code/language-support/javascript/tools/graphql-language-service.md new file mode 100644 index 0000000000..443a090ce2 --- /dev/null +++ b/src/content/code/language-support/javascript/tools/graphql-language-service.md @@ -0,0 +1,9 @@ +--- +name: GraphQL Language Service +description: An interface for building GraphQL language services for IDEs (diagnostics, autocomplete etc). +url: https://github.com/graphql/graphql-language-service +github: graphql/graphql-language-service +npm: "graphql-language-service" +--- + + diff --git a/src/content/code/language-support/javascript/tools/graphql-live-query.md b/src/content/code/language-support/javascript/tools/graphql-live-query.md new file mode 100644 index 0000000000..59eaad5c56 --- /dev/null +++ b/src/content/code/language-support/javascript/tools/graphql-live-query.md @@ -0,0 +1,9 @@ +--- +name: GraphQL Live Query +description: Real-Time with GraphQL for any GraphQL schema or transport. +url: https://github.com/n1ru4l/graphql-live-query +github: n1ru4l/graphql-live-query +npm: "@n1ru4l/graphql-live-query" +--- + + diff --git a/src/content/code/language-support/javascript/tools/graphql-mesh.md b/src/content/code/language-support/javascript/tools/graphql-mesh.md new file mode 100644 index 0000000000..8bf2de4398 --- /dev/null +++ b/src/content/code/language-support/javascript/tools/graphql-mesh.md @@ -0,0 +1,9 @@ +--- +name: GraphQL Mesh +description: GraphQL Mesh allows you to use GraphQL query language to access data in remote APIs that don't run GraphQL (and also ones that do run GraphQL). It can be used as a gateway to other services, or run as a local GraphQL schema that aggregates data from remote APIs. +url: https://graphql-mesh.com +github: Urigo/graphql-mesh +npm: "@graphql-mesh/cli" +--- + + diff --git a/src/content/code/language-support/javascript/tools/graphql-modules.md b/src/content/code/language-support/javascript/tools/graphql-modules.md new file mode 100644 index 0000000000..eeec6b18f6 --- /dev/null +++ b/src/content/code/language-support/javascript/tools/graphql-modules.md @@ -0,0 +1,9 @@ +--- +name: GraphQL Modules +description: GraphQL Modules lets you separate your backend implementation to small, reusable, easy-to-implement and easy-to-test pieces. +url: https://graphql-modules.com +github: Urigo/graphql-modules +npm: "graphql-modules" +--- + + diff --git a/src/content/code/language-support/javascript/tools/graphql-scalars.md b/src/content/code/language-support/javascript/tools/graphql-scalars.md new file mode 100644 index 0000000000..fcbe9a2123 --- /dev/null +++ b/src/content/code/language-support/javascript/tools/graphql-scalars.md @@ -0,0 +1,9 @@ +--- +name: GraphQL Scalars +description: A library of custom GraphQL scalar types for creating precise, type-safe GraphQL schemas. +url: https://github.com/Urigo/graphql-scalars +github: Urigo/graphql-scalars +npm: "graphql-scalars" +--- + + diff --git a/src/content/code/language-support/javascript/tools/graphql-tools.md b/src/content/code/language-support/javascript/tools/graphql-tools.md new file mode 100644 index 0000000000..393b0568e4 --- /dev/null +++ b/src/content/code/language-support/javascript/tools/graphql-tools.md @@ -0,0 +1,9 @@ +--- +name: GraphQL Tools +description: A set of utils for faster development of GraphQL tools (Schema and documents loading, Schema merging and more). +url: https://graphql-tools.com +github: ardatan/graphql-tools +npm: "graphql-tools" +--- + + diff --git a/src/content/code/language-support/javascript/tools/graphql-ws.md b/src/content/code/language-support/javascript/tools/graphql-ws.md new file mode 100644 index 0000000000..1f5222c55c --- /dev/null +++ b/src/content/code/language-support/javascript/tools/graphql-ws.md @@ -0,0 +1,9 @@ +--- +name: GraphQL-WS +description: Coherent, zero-dependency, lazy, simple, GraphQL over WebSocket Protocol compliant server and client. +url: https://github.com/enisdenjo/graphql-ws +github: enisdenjo/graphql-ws +npm: "graphql-ws" +--- + + diff --git a/src/content/code/language-support/javascript/tools/postgraphile.md b/src/content/code/language-support/javascript/tools/postgraphile.md new file mode 100644 index 0000000000..79aedc83c7 --- /dev/null +++ b/src/content/code/language-support/javascript/tools/postgraphile.md @@ -0,0 +1,9 @@ +--- +name: Postgraphile +description: builds a powerful, extensible and performant GraphQL API from a PostgreSQL schema in seconds; saving you weeks if not months of development time. +url: https://www.graphile.org/postgraphile +github: graphile/postgraphile +npm: "postgraphile" +--- + + diff --git a/src/content/code/language-support/javascript/tools/sofa.md b/src/content/code/language-support/javascript/tools/sofa.md new file mode 100644 index 0000000000..becc69b471 --- /dev/null +++ b/src/content/code/language-support/javascript/tools/sofa.md @@ -0,0 +1,9 @@ +--- +name: SOFA +description: Generate REST API from your GraphQL API. +url: https://sofa-api.com/ +github: Urigo/SOFA +npm: "sofa-api" +--- + + diff --git a/src/content/code/language-support/julia/client/diana-jl.md b/src/content/code/language-support/julia/client/diana-jl.md new file mode 100644 index 0000000000..1d2bb4d8bd --- /dev/null +++ b/src/content/code/language-support/julia/client/diana-jl.md @@ -0,0 +1,8 @@ +--- +name: Diana.jl +description: A Julia GraphQL server implementation. +url: https://github.com/codeneomatrix/Diana.jl +github: codeneomatrix/Diana.jl +--- + + diff --git a/src/content/code/language-support/ocaml-reason/server/ocaml-graphql-server.md b/src/content/code/language-support/ocaml-reason/server/ocaml-graphql-server.md new file mode 100644 index 0000000000..8826c9c9a4 --- /dev/null +++ b/src/content/code/language-support/ocaml-reason/server/ocaml-graphql-server.md @@ -0,0 +1,8 @@ +--- +name: ocaml-graphql-server +description: GraphQL server library for OCaml and Reason +url: https://github.com/andreas/ocaml-graphql-server +github: andreas/ocaml-graphql-server +--- + + diff --git a/src/content/code/language-support/perl/server/graphql-perl.md b/src/content/code/language-support/perl/server/graphql-perl.md new file mode 100644 index 0000000000..f9f099c2a1 --- /dev/null +++ b/src/content/code/language-support/perl/server/graphql-perl.md @@ -0,0 +1,16 @@ +--- +name: graphql-perl +description: A Perl port of GraphQL reference implementation +url: https://github.com/graphql-perl/graphql-perl +github: graphql-perl/graphql-perl +--- + +- [MetaCPAN documentation](https://metacpan.org/pod/GraphQL) + + - [Mojolicious-Plugin-GraphQL](https://github.com/graphql-perl/Mojolicious-Plugin-GraphQL) - connect your GraphQL service to a Mojolicious app + + - [GraphQL-Plugin-Convert-DBIC](https://github.com/graphql-perl/GraphQL-Plugin-Convert-DBIC) - automatically connect your DBIx::Class schema to GraphQL + + - [GraphQL-Plugin-Convert-OpenAPI](https://github.com/graphql-perl/GraphQL-Plugin-Convert-OpenAPI) - automatically connect any OpenAPI service (either local Mojolicious one, or remote) to GraphQL + + diff --git a/src/content/code/language-support/php/server/api-platform.md b/src/content/code/language-support/php/server/api-platform.md new file mode 100644 index 0000000000..0f5cfd77d5 --- /dev/null +++ b/src/content/code/language-support/php/server/api-platform.md @@ -0,0 +1,41 @@ +--- +name: API Platform +description: API Platform is a fully-featured, flexible and extensible API framework built on top of Symfony. +url: https://api-platform.com +github: api-platform/api-platform +--- + +The following class is enough to create both a Relay-compatible GraphQL server and a hypermedia API supporting modern REST formats (JSON-LD, JSONAPI...): + +```php +name; + } + // ... +} +``` +Other GraphQLite features include validation, security, error handling, loading via data-loader pattern... diff --git a/src/content/code/language-support/php/server/lighthouse.md b/src/content/code/language-support/php/server/lighthouse.md new file mode 100644 index 0000000000..33bfbf7450 --- /dev/null +++ b/src/content/code/language-support/php/server/lighthouse.md @@ -0,0 +1,8 @@ +--- +name: Lighthouse +description: A GraphQL server for Laravel +url: https://github.com/nuwave/lighthouse +github: nuwave/lighthouse +--- + + diff --git a/src/content/code/language-support/php/server/railt.md b/src/content/code/language-support/php/server/railt.md new file mode 100644 index 0000000000..0c4d999cff --- /dev/null +++ b/src/content/code/language-support/php/server/railt.md @@ -0,0 +1,8 @@ +--- +name: Railt +description: A PHP GraphQL Framework. +url: https://github.com/railt/railt +github: railt/railt +--- + + diff --git a/src/content/code/language-support/php/server/serge.md b/src/content/code/language-support/php/server/serge.md new file mode 100644 index 0000000000..e4a2a0fe96 --- /dev/null +++ b/src/content/code/language-support/php/server/serge.md @@ -0,0 +1,8 @@ +--- +name: serge +description: Use GraphQL to define your Domain Model for CQRS/ES and let serge generate code to handle GraphQL requests. +url: https://github.com/kepawni/serge +github: kepawni/serge +--- + + diff --git a/src/content/code/language-support/php/server/siler.md b/src/content/code/language-support/php/server/siler.md new file mode 100644 index 0000000000..c947260c11 --- /dev/null +++ b/src/content/code/language-support/php/server/siler.md @@ -0,0 +1,43 @@ +--- +name: Siler +description: Siler is a PHP library powered with high-level abstractions to work with GraphQL. +url: https://siler.leocavalcante.com/graphql/ +github: leocavalcante/siler +--- + +To run a Siler hello world script: +```graphql +type Query { + hello: String +} +``` + +```php + [ + 'hello' => 'world', + ], +]; +$schema = Graphqlschema($typeDefs, $resolvers); + +echo "Server running at http://127.0.0.1:8080"; + +Httpserver(Graphqlpsr7($schema), function (Throwable $err) { + var_dump($err); + return Diactorosjson([ + 'error' => true, + 'message' => $err->getMessage(), + ]); +})()->run(); +``` +It also provides functionality for the construction of a WebSocket Subscriptions Server based on how Apollo works. + diff --git a/src/content/code/language-support/php/server/wpgraphql.md b/src/content/code/language-support/php/server/wpgraphql.md new file mode 100644 index 0000000000..2fd292b5a5 --- /dev/null +++ b/src/content/code/language-support/php/server/wpgraphql.md @@ -0,0 +1,8 @@ +--- +name: WPGraphQL +description: A free, open-source WordPress plugin that provides an extendable GraphQL schema and API for any WordPress site +url: https://github.com/wp-graphql/wp-graphql +github: wp-graphql/wp-graphql +--- + + diff --git a/src/content/code/language-support/python/client/gql.md b/src/content/code/language-support/python/client/gql.md new file mode 100644 index 0000000000..8cebdc4361 --- /dev/null +++ b/src/content/code/language-support/python/client/gql.md @@ -0,0 +1,8 @@ +--- +name: GQL +description: A GraphQL client in Python. +url: https://github.com/graphql-python/gql +github: graphql-python/gql +--- + + diff --git a/src/content/code/language-support/python/client/python-graphql-client.md b/src/content/code/language-support/python/client/python-graphql-client.md new file mode 100644 index 0000000000..960e042369 --- /dev/null +++ b/src/content/code/language-support/python/client/python-graphql-client.md @@ -0,0 +1,8 @@ +--- +name: python-graphql-client +description: Simple GraphQL client for Python 2.7+. +url: https://github.com/prisma/python-graphql-client +github: prisma-labs/python-graphql-client +--- + + diff --git a/src/content/code/language-support/python/client/sgqlc.md b/src/content/code/language-support/python/client/sgqlc.md new file mode 100644 index 0000000000..20ec654363 --- /dev/null +++ b/src/content/code/language-support/python/client/sgqlc.md @@ -0,0 +1,8 @@ +--- +name: sgqlc +description: A simple Python GraphQL client. Supports generating code generation for types defined in a GraphQL schema. +url: https://github.com/profusion/sgqlc +github: profusion/sgqlc +--- + + diff --git a/src/content/code/language-support/python/server/ariadne.md b/src/content/code/language-support/python/server/ariadne.md new file mode 100644 index 0000000000..aa6f3ca0c1 --- /dev/null +++ b/src/content/code/language-support/python/server/ariadne.md @@ -0,0 +1,43 @@ +--- +name: Ariadne +description: Ariadne is a Python library for implementing GraphQL servers using schema-first approach. It supports both synchronous and asynchronous query execution, ships with batteries included for common GraphQL server problems like query cost validation or performance tracing and has simple API that is easy to extend or replace. +url: https://ariadnegraphql.org +github: mirumee/ariadne +--- + +Ariadne can be installed with pip: + +```bash +pip install ariadne +``` + +It ships with many GraphQL server implementations, enabling easy experimentation: + +```python +from ariadne import ObjectType, QueryType, gql, make_executable_schema +from ariadne.asgi import GraphQL +# Define types using Schema Definition Language (https://graphql.org/learn/schema/) +# Wrapping string in gql function provides validation and better error traceback +type_defs = gql(""" + type Query { + hello: String! + } +""") +# Bind resolver functions to Query's fields using QueryType +query_type = QueryType() +# Resolvers are simple python functions +@query_type.field("hello") +def resolve_hello(*_): + return "Hello world!" +# Create executable GraphQL schema +schema = make_executable_schema(type_defs, query_type) +# Create an ASGI app using the schema, running in debug mode +app = GraphQL(schema, debug=True) +``` + +Above server can be ran with uvicorn: + +``` +pip install uvicorn +uvicorn example:app +``` diff --git a/src/content/code/language-support/python/server/graphene.md b/src/content/code/language-support/python/server/graphene.md new file mode 100644 index 0000000000..772aaabc70 --- /dev/null +++ b/src/content/code/language-support/python/server/graphene.md @@ -0,0 +1,30 @@ +--- +name: Graphene +description: A Python library for building GraphQL APIs. +url: http://graphene-python.org/ +github: graphql-python/graphene +--- + +To run a Graphene hello world script: + +```bash +pip install graphene +``` + +Then run `python hello.py` with this code in `hello.py`: + +```python +import graphene + +class Query(graphene.ObjectType): + hello = graphene.String(name=graphene.String(default_value="World")) + + def resolve_hello(self, info, name): + return 'Hello ' + name + +schema = graphene.Schema(query=Query) +result = schema.execute('{ hello }') +print(result.data['hello']) # "Hello World" +``` + +There are also nice bindings for [Relay](https://facebook.github.io/relay/), Django, SQLAlchemy, and Google App Engine. diff --git a/src/content/code/language-support/python/server/tartiflette.md b/src/content/code/language-support/python/server/tartiflette.md new file mode 100644 index 0000000000..b9c78af3eb --- /dev/null +++ b/src/content/code/language-support/python/server/tartiflette.md @@ -0,0 +1,34 @@ +--- +name: Tartiflette +description: A Python 3.6+ _(asyncio)_ library for building GraphQL APIs. +url: https://tartiflette.io +github: tartiflette/tartiflette +--- + +To run a tartiflette hello world script: +```bash +pip install tartiflette +``` +Then run `python hello.py` with this code in `hello.py`: +```python +import asyncio +from tartiflette import Engine, Resolver +@Resolver("Query.hello") +async def resolver_hello(parent, args, ctx, info): + return "hello " + args["name"] +async def run(): + tftt_engine = Engine(""" + type Query { + hello(name: String): String + } + """) + result = await tftt_engine.execute( + query='query { hello(name: "Chuck") }' + ) + print(result) + # {'data': {'hello': 'hello Chuck'}} +if __name__ == "__main__": + loop = asyncio.get_event_loop() + loop.run_until_complete(run()) +``` +There is also a nice [HTTP wrapper](https://github.com/dailymotion/tartiflette-aiohttp). diff --git a/src/content/code/language-support/r/server/ghql.md b/src/content/code/language-support/r/server/ghql.md new file mode 100644 index 0000000000..b832a4e73b --- /dev/null +++ b/src/content/code/language-support/r/server/ghql.md @@ -0,0 +1,8 @@ +--- +name: ghql +description: General purpose GraphQL R client +url: https://github.com/ropensci/ghql +github: ropensci/ghql +--- + + diff --git a/src/content/code/language-support/ruby/server/agoo.md b/src/content/code/language-support/ruby/server/agoo.md new file mode 100644 index 0000000000..be7b315dd5 --- /dev/null +++ b/src/content/code/language-support/ruby/server/agoo.md @@ -0,0 +1,37 @@ +--- +name: Agoo +description: A high performance web server with support for GraphQL. Agoo strives for a simple, easy to use API for GraphQL. +url: https://github.com/ohler55/agoo +github: ohler55/agoo +gem: agoo +--- + +```ruby +require 'agoo' + +class Query + def hello + 'hello' + end +end + +class Schema + attr_reader :query + + def initialize + @query = Query.new() + end +end + +Agoo::Server.init(6464, 'root', thread_count: 1, graphql: '/graphql') +Agoo::Server.start() +Agoo::GraphQL.schema(Schema.new) { + Agoo::GraphQL.load(%^type Query { hello: String }^) +} +sleep + +# To run this GraphQL example type the following then go to a browser and enter +# a URL of localhost:6464/graphql?query={hello} +# +# ruby hello.rb +``` diff --git a/src/content/code/language-support/ruby/server/graphql-ruby.md b/src/content/code/language-support/ruby/server/graphql-ruby.md new file mode 100644 index 0000000000..847cb44833 --- /dev/null +++ b/src/content/code/language-support/ruby/server/graphql-ruby.md @@ -0,0 +1,33 @@ +--- +name: graphql-ruby +description: A Ruby library for building GraphQL APIs. +url: https://github.com/rmosolgo/graphql-ruby +github: rmosolgo/graphql-ruby +gem: graphql +--- + +To run a hello world script with `graphql-ruby`: +```bash +gem install graphql +``` + +Then run `ruby hello.rb` with this code in `hello.rb`: + +```ruby +require 'graphql' + +class QueryType < GraphQL::Schema::Object + graphql_name 'Query' + field :hello do + type types.String + resolve -> (obj, args, ctx) { 'Hello world!' } + end +end + +class Schema < GraphQL::Schema + query QueryType +end + +puts Schema.execute('{ hello }').to_json +``` +There are also nice bindings for Relay and Rails. diff --git a/src/content/code/language-support/rust/server/async-graphql.md b/src/content/code/language-support/rust/server/async-graphql.md new file mode 100644 index 0000000000..77b29bc9c2 --- /dev/null +++ b/src/content/code/language-support/rust/server/async-graphql.md @@ -0,0 +1,18 @@ +--- +name: Async-graphql +description: Async-graphql is a high-performance server-side library that supports all GraphQL specifications. +url: https://github.com/async-graphql/async-graphql +github: async-graphql/async-graphql +--- + +```rust + use async_graphql::*; + struct Query; + #[Object] + impl Query { + /// Returns the sum of a and b + async fn add(&self, a: i32, b: i32) -> i32 { + a + b + } + } + ``` diff --git a/src/content/code/language-support/rust/server/graphql-rust-juniper.md b/src/content/code/language-support/rust/server/graphql-rust-juniper.md new file mode 100644 index 0000000000..7cf7c961f5 --- /dev/null +++ b/src/content/code/language-support/rust/server/graphql-rust-juniper.md @@ -0,0 +1,8 @@ +--- +name: graphql-rust/juniper +description: GraphQL server library for Rust +url: https://github.com/graphql-rust/juniper +github: graphql-rust/juniper +--- + + diff --git a/src/content/code/language-support/scala/server/sangria.md b/src/content/code/language-support/scala/server/sangria.md new file mode 100644 index 0000000000..c900b46ed6 --- /dev/null +++ b/src/content/code/language-support/scala/server/sangria.md @@ -0,0 +1,23 @@ +--- +name: Sangria +description: A Scala GraphQL library that supports [Relay](https://facebook.github.io/relay/). +url: http://sangria-graphql.org/ +github: sangria-graphql/sangria +--- + +An example of a hello world GraphQL schema and query with `sangria`: +```scala +import sangria.schema._ +import sangria.execution._ +import sangria.macros._ + +val QueryType = ObjectType("Query", fields[Unit, Unit]( + Field("hello", StringType, resolve = _ ⇒ "Hello world!") +)) + +val schema = Schema(QueryType) + +val query = graphql"{ hello }" + +Executor.execute(schema, query) map println +``` diff --git a/src/content/code/language-support/swift-objective-c-ios/client/apollo-ios.md b/src/content/code/language-support/swift-objective-c-ios/client/apollo-ios.md new file mode 100644 index 0000000000..5bc1c64ac8 --- /dev/null +++ b/src/content/code/language-support/swift-objective-c-ios/client/apollo-ios.md @@ -0,0 +1,8 @@ +--- +name: Apollo iOS +description: A GraphQL client for iOS that returns results as query-specific Swift types, and integrates with Xcode to show your Swift source and GraphQL side by side, with inline validation errors. +url: https://www.apollographql.com/docs/ios/ +github: apollographql/apollo-ios +--- + + diff --git a/src/content/code/language-support/swift-objective-c-ios/client/caliban.md b/src/content/code/language-support/swift-objective-c-ios/client/caliban.md new file mode 100644 index 0000000000..881e35a0d5 --- /dev/null +++ b/src/content/code/language-support/swift-objective-c-ios/client/caliban.md @@ -0,0 +1,8 @@ +--- +name: Caliban +description: Functional GraphQL library for Scala, with client code generation and type-safe queries. +url: https://ghostdogpr.github.io/caliban/ +github: ghostdogpr/caliban +--- + + diff --git a/src/content/code/language-support/swift-objective-c-ios/client/graphaello.md b/src/content/code/language-support/swift-objective-c-ios/client/graphaello.md new file mode 100644 index 0000000000..27167b6e00 --- /dev/null +++ b/src/content/code/language-support/swift-objective-c-ios/client/graphaello.md @@ -0,0 +1,8 @@ +--- +name: Graphaello +description: A Tool for Writing Declarative, Type-Safe and Data-Driven Applications in SwiftUI using GraphQL and Apollo +url: https://github.com/nerdsupremacist/Graphaello +github: nerdsupremacist/Graphaello +--- + + diff --git a/src/content/code/language-support/swift-objective-c-ios/client/graphql-ios.md b/src/content/code/language-support/swift-objective-c-ios/client/graphql-ios.md new file mode 100644 index 0000000000..b4492cd232 --- /dev/null +++ b/src/content/code/language-support/swift-objective-c-ios/client/graphql-ios.md @@ -0,0 +1,8 @@ +--- +name: GraphQL iOS +description: An Objective-C GraphQL client for iOS. +url: https://github.com/funcompany/graphql-ios +github: funcompany/graphql-ios +--- + + diff --git a/src/content/code/language-support/swift-objective-c-ios/server/caliban.md b/src/content/code/language-support/swift-objective-c-ios/server/caliban.md new file mode 100644 index 0000000000..71722002a1 --- /dev/null +++ b/src/content/code/language-support/swift-objective-c-ios/server/caliban.md @@ -0,0 +1,36 @@ +--- +name: Caliban +description: Caliban is a purely functional library for building GraphQL servers and clients in Scala +url: https://ghostdogpr.github.io/caliban/ +github: ghostdogpr/caliban +--- + +An example of a GraphQL schema and query with `caliban`: +```scala +case class Character(name: String, age: Int) +def getCharacters(): List[Character] = ??? +def getCharacter(name: String): Option[Character] = ??? +// schema +case class CharacterName(name: String) +case class Queries(characters: List[Character], + character: CharacterName => Option[Character]) +// resolver +val queries = Queries(getCharacters, args => getCharacter(args.name)) +import caliban.GraphQL.graphQL +import caliban.RootResolver +val api = graphQL(RootResolver(queries)) +for { + interpreter <- api.interpreter +} yield interpreter +case class GraphQLResponse[+E](data: ResponseValue, errors: List[E]) +val query = """ + { + characters { + name + } + }""" +for { + result <- interpreter.execute(query) + _ <- zio.console.putStrLn(result.data.toString) +} yield () +``` diff --git a/src/content/code/language-support/swift-objective-c-ios/server/graphiti.md b/src/content/code/language-support/swift-objective-c-ios/server/graphiti.md new file mode 100644 index 0000000000..f6a51dd945 --- /dev/null +++ b/src/content/code/language-support/swift-objective-c-ios/server/graphiti.md @@ -0,0 +1,8 @@ +--- +name: Graphiti +description: Swift library for building GraphQL schemas/types fast, safely and easily. +url: https://github.com/GraphQLSwift/Graphiti +github: GraphQLSwift/Graphiti +--- + + diff --git a/src/content/code/language-support/swift-objective-c-ios/server/graphzahl.md b/src/content/code/language-support/swift-objective-c-ios/server/graphzahl.md new file mode 100644 index 0000000000..dfacfe38aa --- /dev/null +++ b/src/content/code/language-support/swift-objective-c-ios/server/graphzahl.md @@ -0,0 +1,8 @@ +--- +name: GraphZahl +description: Swift library for writing Declarative, Type-Safe GraphQL APIs with Zero Boilerplate. +url: https://github.com/nerdsupremacist/GraphZahl +github: nerdsupremacist/GraphZahl +--- + + diff --git a/src/content/code/services/altair.md b/src/content/code/services/altair.md new file mode 100644 index 0000000000..979bb1bf9e --- /dev/null +++ b/src/content/code/services/altair.md @@ -0,0 +1,7 @@ +--- +name: Altair +description: An alternative to Postman that supports editing GraphQL queries directly and autoload your GraphQL schema. +url: https://altair.sirmuel.design/ +--- + + diff --git a/src/content/code/services/apollo-graph-manager.md b/src/content/code/services/apollo-graph-manager.md new file mode 100644 index 0000000000..d0283fd22f --- /dev/null +++ b/src/content/code/services/apollo-graph-manager.md @@ -0,0 +1,7 @@ +--- +name: Apollo Graph Manager +description: A cloud service for monitoring the performance and usage of your GraphQL backend. +url: https://engine.apollographql.com +--- + + diff --git a/src/content/code/services/aws-appsync.md b/src/content/code/services/aws-appsync.md new file mode 100644 index 0000000000..21fc42ae78 --- /dev/null +++ b/src/content/code/services/aws-appsync.md @@ -0,0 +1,7 @@ +--- +name: AWS AppSync +description: Fully managed GraphQL service with realtime subscriptions, offline programming & synchronization, and enterprise security features as well as fine grained authorization controls. +url: https://aws.amazon.com/appsync/ +--- + + diff --git a/src/content/code/services/elide.md b/src/content/code/services/elide.md new file mode 100644 index 0000000000..64ef631169 --- /dev/null +++ b/src/content/code/services/elide.md @@ -0,0 +1,7 @@ +--- +name: Elide +description: A Java library that can expose a JPA annotated data model as a GraphQL service over any relational database. +url: https://elide.io +--- + + diff --git a/src/content/code/services/faunadb.md b/src/content/code/services/faunadb.md new file mode 100644 index 0000000000..decd136ab3 --- /dev/null +++ b/src/content/code/services/faunadb.md @@ -0,0 +1,7 @@ +--- +name: FaunaDB +description: Create an instant GraphQL backend by importing a gql schema. The database will create relations and indexes for you, so you'll be ready to query in seconds, without writing any database code. Serverless pricing, free to get started. +url: https://docs.fauna.com/fauna/current/graphql +--- + + diff --git a/src/content/code/services/graphcms.md b/src/content/code/services/graphcms.md new file mode 100644 index 0000000000..5ae71b45d8 --- /dev/null +++ b/src/content/code/services/graphcms.md @@ -0,0 +1,7 @@ +--- +name: GraphCMS +description: A BaaS (Backend as a Service) that sets you up with a GraphQL backend as well as tools for content editors to work with the stored data. +url: https://graphcms.com/ +--- + + diff --git a/src/content/code/services/hasura.md b/src/content/code/services/hasura.md new file mode 100644 index 0000000000..dc72b4317f --- /dev/null +++ b/src/content/code/services/hasura.md @@ -0,0 +1,8 @@ +--- +name: Hasura +description: Hasura connects to your databases & microservices and instantly gives you a production-ready GraphQL API. +url: https://hasura.io +github: hasura/graphql-engine +--- + + diff --git a/src/content/code/services/lexascms.md b/src/content/code/services/lexascms.md new file mode 100644 index 0000000000..10907871c5 --- /dev/null +++ b/src/content/code/services/lexascms.md @@ -0,0 +1,7 @@ +--- +name: LexasCMS +description: A headless CMS (Content Management System) that combines powerful content personalisation and scheduling capabilities with a modern content editing experience and a blazing fast GraphQL/REST content delivery API. +url: https://www.lexascms.com +--- + + diff --git a/src/content/code/services/moesif-api-analytics.md b/src/content/code/services/moesif-api-analytics.md new file mode 100644 index 0000000000..3c903be90d --- /dev/null +++ b/src/content/code/services/moesif-api-analytics.md @@ -0,0 +1,7 @@ +--- +name: Moesif API Analytics +description: A GraphQL analaytics and monitoring Service to find functional and performance issues. +url: https://www.moesif.com/features/graphql-analytics +--- + + diff --git a/src/content/code/services/postman.md b/src/content/code/services/postman.md new file mode 100644 index 0000000000..749a1b49e7 --- /dev/null +++ b/src/content/code/services/postman.md @@ -0,0 +1,7 @@ +--- +name: Postman +description: An HTTP Client that supports editing GraphQL queries. +url: https://learning.postman.com/docs/sending-requests/supported-api-frameworks/graphql/ +--- + + diff --git a/src/content/code/services/prisma.md b/src/content/code/services/prisma.md new file mode 100644 index 0000000000..a01d88d797 --- /dev/null +++ b/src/content/code/services/prisma.md @@ -0,0 +1,8 @@ +--- +name: Prisma +description: A BaaS (Backend as a Service) providing a GraphQL backend for your applications with a powerful web ui for managing your database and stored data. +url: https://www.prisma.io +github: prisma/prisma +--- + + diff --git a/src/content/code/services/tipe.md b/src/content/code/services/tipe.md new file mode 100644 index 0000000000..eca017351a --- /dev/null +++ b/src/content/code/services/tipe.md @@ -0,0 +1,8 @@ +--- +name: Tipe +description: A SaaS (Software as a Service) content management system that allows you to create your content with powerful editing tools and access it from anywhere with a GraphQL or REST API. +url: https://tipe.io +github: tipeio/tipe +--- + + diff --git a/src/content/code/slug-map.json b/src/content/code/slug-map.json new file mode 100644 index 0000000000..a4895135eb --- /dev/null +++ b/src/content/code/slug-map.json @@ -0,0 +1,30 @@ +{ + "c-c": "C / C++", + "c-net": "C# / .NET", + "clojure": "Clojure", + "d": "D", + "elixir": "Elixir", + "elm": "Elm", + "erlang": "Erlang", + "flutter": "Flutter", + "go": "Go", + "groovy": "Groovy", + "haskell": "Haskell", + "java-kotlin-android": "Java / Kotlin", + "javascript": "JavaScript", + "julia": "Julia", + "perl": "Perl", + "php": "PHP", + "python": "Python", + "r": "R", + "ruby": "Ruby", + "rust": "Rust", + "scala": "Scala", + "ocaml-reason": "OCaml / Reason", + "swift-objective-c-ios": "Swift / Objective-C", + "language-support": "Language Support", + "client": "Client", + "server": "Server", + "tools": "Tools", + "services": "Services" +} diff --git a/src/content/code/tools/graphql-code-generator.md b/src/content/code/tools/graphql-code-generator.md new file mode 100644 index 0000000000..ac5bf4fed5 --- /dev/null +++ b/src/content/code/tools/graphql-code-generator.md @@ -0,0 +1,9 @@ +--- +name: GraphQL Code Generator +description: GraphQL code generator with flexible support for custom plugins and templates like Typescript (frontend and backend), React Hooks, resolvers signatures and more. +url: https://graphql-code-generator.com +github: dotansimha/graphql-code-generator +npm: "@graphql-codegen/cli" +--- + + diff --git a/src/content/code/tools/quicktype.md b/src/content/code/tools/quicktype.md new file mode 100644 index 0000000000..e5278b2798 --- /dev/null +++ b/src/content/code/tools/quicktype.md @@ -0,0 +1,9 @@ +--- +name: quicktype +description: Generate types for GraphQL queries in TypeScript, Swift, golang, C#, C++, and more. +url: https://quicktype.io/ +github: quicktype/quicktype +npm: "quicktype" +--- + + diff --git a/src/pages/blog.tsx b/src/pages/blog.tsx index 65b349e946..ffed462814 100644 --- a/src/pages/blog.tsx +++ b/src/pages/blog.tsx @@ -4,7 +4,7 @@ import BlogPost from "../components/BlogPost" import BlogSidebar from "../components/BlogSidebar" import { graphql } from "gatsby" -export default ({ pageContext, data }) => { +export default ({ pageContext, data }: any) => { const posts = data.allMarkdownRemark.edges .map((e: any) => e.node) .sort((a: any, b: any) => { @@ -39,6 +39,7 @@ export default ({ pageContext, data }) => { guestBio={guestBio} rawMarkdownBody={rawMarkdownBody} isPermalink={false} + pageContext={pageContext} /> ) )} diff --git a/src/pages/code.tsx b/src/pages/code.tsx new file mode 100644 index 0000000000..0e3ae0a916 --- /dev/null +++ b/src/pages/code.tsx @@ -0,0 +1,257 @@ +import { AnchorLink } from "gatsby-plugin-anchor-links" +import React, { useState } from "react" +import Layout from "../components/Layout" +import Marked from "../components/Marked" +import { toSlug } from "../utils/slug" + +export function buildLanguagesMenu(pageContext: any) { + return ( +
+ {pageContext.languageList.map(({ name: languageName }) => { + const slug = toSlug(languageName) + return ( + + {languageName} + + ) + })} +
+ ) +} + +export function buildLibraryContent(library: any, pageContext: any) { + const [ overflown, setOverflown ] = useState(false); + const [ expanded, setExpanded ] = useState(false); + return ( +
+
+ +

{library.name}

+
+ {library.github && ( + + )} + {library.npm && ( + + )} + {library.gem && ( + + )} + {library.lastRelease && ( +
+ Last Release + {library.formattedLastRelease} +
+ )} + {library.stars && ( +
+ Stars + {library.formattedStars} +
+ )} + {library.license && ( +
+ License + {library.license} +
+ )} + {library.howto ? ( +
+ {library.description} +
+ ) : ( +
+ )} +
+
+
{ + if (el && !overflown) { + setOverflown(el.clientHeight < el.scrollHeight) + } + }} + > + + {library.howto || library.description} + +
+ {overflown && ( +
setExpanded(true)}> + +
+ )} +
+
+ ) +} + +export function buildLibraryList(libraries: any[], pageContext: any) { + return ( +
+ {libraries.map(library => buildLibraryContent(library, pageContext))} +
+ ) +} + +export function buildLibraryCategoryContent( + libraryCategories: any[], + libraryCategoryName: string, + slug: string, + pageContext: any +) { + if (libraryCategoryName in libraryCategories) { + const libraries = libraryCategories[libraryCategoryName as any] + return ( +
+

{libraryCategoryName}

+ {buildLibraryList(libraries, pageContext)} +
+ ) + } + return +} + +const categorySlugMap = [ + ["Server", toSlug("Server")], + ["Client", toSlug("Client")], + ["Tools", toSlug("Tools")], +] + +export function buildLanguagesContent(pageContext: any) { + const elements = [] + for (const languageObj of pageContext.languageList) { + const languageName = languageObj.name + const libraryCategories = languageObj.categoryMap + const filteredCategorySlugMap = categorySlugMap.filter( + ([libraryCategoryName]) => + libraryCategories[libraryCategoryName as any]?.length + ) + const languageSlug = toSlug(languageName) + elements.push( +
+
+

{languageName}

+ {filteredCategorySlugMap.length > 1 && ( +

+ {filteredCategorySlugMap.map( + ([libraryCategoryName, categorySlug], i) => ( + <> + + {libraryCategoryName} + + {i < filteredCategorySlugMap.length - 1 && " / "} + + ) + )} +

+ )} +
+
+ {filteredCategorySlugMap.map(([categoryName, categorySlug]) => + buildLibraryCategoryContent( + libraryCategories, + categoryName, + `${languageSlug}-${categorySlug}`, + pageContext + ) + )} +
+
+ ) + } + return
{elements}
+} + +export default ({ pageContext }: any) => { + return ( + +
+
+

Code

+

using GraphQL

+
+
+
+
+
+
+

+ Because GraphQL is a communication pattern, there are many tools + to help you get started working which support GraphQL in all + sorts of languages. +

+
+

Go to

+
+ +

Language Support

+
+ +

Tools

+
+ +

Services

+
+
+
+
+ +

+ Language Support +

+ {buildLanguagesMenu(pageContext)} + {buildLanguagesContent(pageContext)} +

+ + Tools + + # + +

+ {buildLibraryList(pageContext.otherLibraries.Tools, pageContext)} +

+ + Services + + # + +

+ {buildLibraryList(pageContext.otherLibraries.Services, pageContext)} +
+
+
+
+ ) +} diff --git a/src/templates/doc.tsx b/src/templates/doc.tsx index e877216ccc..d179668dfa 100644 --- a/src/templates/doc.tsx +++ b/src/templates/doc.tsx @@ -39,6 +39,7 @@ const Blog = ({ data, pageContext }: Props) => { rawMarkdownBody={rawMarkdownBody} nextDoc={nextDoc} sideBarData={pageContext.sideBarData} + pageContext={pageContext} /> ) diff --git a/static/img/downarrow.svg b/static/img/downarrow.svg new file mode 100644 index 0000000000..66d1586245 --- /dev/null +++ b/static/img/downarrow.svg @@ -0,0 +1,3 @@ + + + diff --git a/yarn.lock b/yarn.lock index beb86c53ba..f223de2497 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2366,6 +2366,11 @@ big.js@^5.2.2: resolved "https://registry.yarnpkg.com/big.js/-/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328" integrity sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ== +bignumber.js@^8.1.1: + version "8.1.1" + resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-8.1.1.tgz#4b072ae5aea9c20f6730e4e5d529df1271c4d885" + integrity sha512-QD46ppGintwPGuL1KqmwhR0O+N2cZUg8JG/VzwI2e28sM9TqHjQB10lI4QAaMHVbLzwVLLAwEglpKPViWX+5NQ== + binary-extensions@^1.0.0: version "1.13.1" resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.13.1.tgz#598afe54755b2868a5330d2aff9d4ebb53209b65" @@ -4902,6 +4907,14 @@ file-entry-cache@^5.0.1: dependencies: flat-cache "^2.0.1" +file-is-binary@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/file-is-binary/-/file-is-binary-1.0.0.tgz#5e41806d1bcae458c8fec32fe3ce122dbbbc4356" + integrity sha1-XkGAbRvK5FjI/sMv484SLbu8Q1Y= + dependencies: + is-binary-buffer "^1.0.0" + isobject "^3.0.0" + file-loader@^1.1.11: version "1.1.11" resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-1.1.11.tgz#6fe886449b0f2a936e43cabaac0cdbfb369506f8" @@ -5958,6 +5971,16 @@ graphql@^14.6.0, graphql@^14.7.0: dependencies: iterall "^1.2.2" +gray-matter@^3.0.2: + version "3.1.1" + resolved "https://registry.yarnpkg.com/gray-matter/-/gray-matter-3.1.1.tgz#101f80d9e69eeca6765cdce437705b18f40876ac" + integrity sha512-nZ1qjLmayEv0/wt3sHig7I0s3/sJO0dkAaKYQ5YAOApUtYEOonXSFdWvL1khvnZMTvov4UufkqlFsilPnejEXA== + dependencies: + extend-shallow "^2.0.1" + js-yaml "^3.10.0" + kind-of "^5.0.2" + strip-bom-string "^1.0.0" + gray-matter@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/gray-matter/-/gray-matter-4.0.2.tgz#9aa379e3acaf421193fce7d2a28cebd4518ac454" @@ -6685,6 +6708,13 @@ is-arrayish@^0.3.1: resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.3.2.tgz#4574a2ae56f7ab206896fb431eaeed066fdf8f03" integrity sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ== +is-binary-buffer@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-binary-buffer/-/is-binary-buffer-1.0.0.tgz#bc6031290b65cbf799b9d9502b50fd5375524007" + integrity sha1-vGAxKQtly/eZudlQK1D9U3VSQAc= + dependencies: + is-buffer "^1.1.5" + is-binary-path@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-1.0.1.tgz#75f16642b480f187a711c814161fd3a4a7655898" @@ -7051,6 +7081,11 @@ is-whitespace-character@^1.0.0: resolved "https://registry.yarnpkg.com/is-whitespace-character/-/is-whitespace-character-1.0.4.tgz#0858edd94a95594c7c9dd0b5c174ec6e45ee4aa7" integrity sha512-SDweEzfIZM0SJV0EUga669UTKlmL0Pq8Lno0QDQsPnvECB3IM2aP0gdx5TrU0A01MAPfViaZiI2V1QMZLaKK5w== +is-whitespace@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/is-whitespace/-/is-whitespace-0.3.0.tgz#1639ecb1be036aec69a54cbb401cfbed7114ab7f" + integrity sha1-Fjnssb4DauxppUy7QBz77XEUq38= + is-windows@^1.0.1, is-windows@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" @@ -7175,7 +7210,7 @@ js-tokens@^3.0.2: resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" integrity sha1-mGbfOVECEw449/mWvOtlRDIJwls= -js-yaml@^3.11.0, js-yaml@^3.13.1: +js-yaml@^3.10.0, js-yaml@^3.11.0, js-yaml@^3.13.1: version "3.14.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.0.tgz#a7a34170f26a21bb162424d8adacb4113a69e482" integrity sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A== @@ -7309,7 +7344,7 @@ kind-of@^4.0.0: dependencies: is-buffer "^1.1.5" -kind-of@^5.0.0: +kind-of@^5.0.0, kind-of@^5.0.2: version "5.1.0" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-5.1.0.tgz#729c91e2d857b7a419a1f9aa65685c4c33f5845d" integrity sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw== @@ -7351,6 +7386,13 @@ latest-version@5.1.0, latest-version@^5.0.0: dependencies: package-json "^6.3.0" +lazy-cache@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-2.0.2.tgz#b9190a4f913354694840859f8a8f7084d8822264" + integrity sha1-uRkKT5EzVGlIQIWfio9whNiCImQ= + dependencies: + set-getter "^0.1.0" + less-loader@^6.2.0: version "6.2.0" resolved "https://registry.yarnpkg.com/less-loader/-/less-loader-6.2.0.tgz#8b26f621c155b342eefc24f5bd6e9dc40c42a719" @@ -8322,6 +8364,13 @@ num2fraction@^1.2.2: resolved "https://registry.yarnpkg.com/num2fraction/-/num2fraction-1.2.2.tgz#6f682b6a027a4e9ddfa4564cd2589d1d4e669ede" integrity sha1-b2gragJ6Tp3fpFZM0lidHU5mnt4= +numbro@2.3.2: + version "2.3.2" + resolved "https://registry.yarnpkg.com/numbro/-/numbro-2.3.2.tgz#4967c631b0ea99b17dd7f88cdd1eaa4ace4d4971" + integrity sha512-GHRdsyYs6ugRP0mipuBKTybzTPKdlhzKh271PG3hPwL1fg2DKwK/I2nCsh0gW3FfIKBzWIFoBnousQfiAkOuwQ== + dependencies: + bignumber.js "^8.1.1" + object-assign@^4, object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" @@ -8795,6 +8844,19 @@ parseqs@0.0.6: resolved "https://registry.yarnpkg.com/parseqs/-/parseqs-0.0.6.tgz#8e4bb5a19d1cdc844a08ac974d34e273afa670d5" integrity sha512-jeAGzMDbfSHHA091hr0r31eYfTig+29g3GKKE/PPbEQ65X0lmMwlEoqmhzu0iztID5uJpZsFlUPDP8ThPL7M8w== +parser-front-matter@1.6.4: + version "1.6.4" + resolved "https://registry.yarnpkg.com/parser-front-matter/-/parser-front-matter-1.6.4.tgz#71fe3288a51c7b8734163f3793f3fdc24b0a8a90" + integrity sha512-eqtUnI5+COkf1CQOYo8FmykN5Zs+5Yr60f/7GcPgQDZEEjdE/VZ4WMaMo9g37foof8h64t/TH2Uvk2Sq0fDy/g== + dependencies: + extend-shallow "^2.0.1" + file-is-binary "^1.0.0" + gray-matter "^3.0.2" + isobject "^3.0.1" + lazy-cache "^2.0.2" + mixin-deep "^1.2.0" + trim-leading-lines "^0.1.1" + parseuri@0.0.5: version "0.0.5" resolved "https://registry.yarnpkg.com/parseuri/-/parseuri-0.0.5.tgz#80204a50d4dbb779bfdc6ebe2778d90e4bce320a" @@ -10476,6 +10538,13 @@ set-blocking@^2.0.0: resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= +set-getter@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/set-getter/-/set-getter-0.1.0.tgz#d769c182c9d5a51f409145f2fba82e5e86e80376" + integrity sha1-12nBgsnVpR9AkUXy+6guXoboA3Y= + dependencies: + to-object-path "^0.3.0" + set-value@^2.0.0, set-value@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/set-value/-/set-value-2.0.1.tgz#a18d40530e6f07de4228c7defe4227af8cad005b" @@ -11321,6 +11390,11 @@ thunky@^1.0.2: resolved "https://registry.yarnpkg.com/thunky/-/thunky-1.1.0.tgz#5abaf714a9405db0504732bbccd2cedd9ef9537d" integrity sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA== +timeago.js@4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/timeago.js/-/timeago.js-4.0.2.tgz#724e8c8833e3490676c7bb0a75f5daf20e558028" + integrity sha512-a7wPxPdVlQL7lqvitHGGRsofhdwtkoSXPGATFuSOA2i1ZNQEPLrGnj68vOp2sOJTCFAQVXPeNMX/GctBaO9L2w== + timed-out@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/timed-out/-/timed-out-4.0.1.tgz#f32eacac5a175bea25d7fab565ab3ed8741ef56f" @@ -11414,6 +11488,13 @@ toidentifier@1.0.0: resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.0.tgz#7e1be3470f1e77948bc43d94a3c8f4d7752ba553" integrity sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw== +trim-leading-lines@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/trim-leading-lines/-/trim-leading-lines-0.1.1.tgz#0e7cac3e83042dcf95a74ed36966f17744d5c169" + integrity sha1-DnysPoMELc+Vp07TaWbxd0TVwWk= + dependencies: + is-whitespace "^0.3.0" + trim-lines@^1.0.0: version "1.1.3" resolved "https://registry.yarnpkg.com/trim-lines/-/trim-lines-1.1.3.tgz#839514be82428fd9e7ec89e35081afe8f6f93115"