Skip to content

Commit

Permalink
Merge branch 'graphql:source' into custom-speakers-page
Browse files Browse the repository at this point in the history
  • Loading branch information
YassinEldeeb authored Jul 21, 2023
2 parents 38c357d + b52ece7 commit 60a8453
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 13 deletions.
7 changes: 7 additions & 0 deletions gatsby-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,13 @@ export const createPages: GatsbyNode["createPages"] = async ({
toPath: "/conf/schedule",
})

// redirect swapi with 200
createRedirect({
fromPath: `/swapi-graphql/*`,
toPath: `https://graphql.github.io/swapi-graphql/*`,
statusCode: 200,
})

const result = await graphql(`
query allMarkdownRemark {
allMarkdownRemark {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
name: GraphQL-HTTP
description: Simple, pluggable, zero-dependency, GraphQL over HTTP spec compliant server, client and audit suite.
url: https://github.com/graphql/graphql-http
github: graphql/graphql-http
npm: "graphql-http"
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
name: GraphQL-HTTP
description: Simple, pluggable, zero-dependency, GraphQL over HTTP spec compliant server, client and audit suite.
url: https://github.com/graphql/graphql-http
github: graphql/graphql-http
npm: "graphql-http"
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
name: GraphQL-SSE
description: Zero-dependency, HTTP/1 safe, simple, GraphQL over Server-Sent Events Protocol server and client.
url: https://github.com/enisdenjo/graphql-sse
github: enisdenjo/graphql-sse
npm: "graphql-sse"
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
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"
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
name: GraphQL-HTTP
description: Simple, pluggable, zero-dependency, GraphQL over HTTP spec compliant server, client and audit suite.
url: https://github.com/graphql/graphql-http
github: graphql/graphql-http
npm: "graphql-http"
---
17 changes: 16 additions & 1 deletion src/content/code/language-support/scala/client/caliban.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
---
name: Caliban
description: Functional GraphQL library for Scala, with client code generation and type-safe queries.
description: Caliban is a functional library for building GraphQL servers and clients in Scala. It offers with client code generation and type-safe queries.
url: https://ghostdogpr.github.io/caliban/
github: ghostdogpr/caliban
---

An example of defining a GraphQL query and running it with `caliban`:

```scala
// define your query using Scala
val query: SelectionBuilder[RootQuery, List[CharacterView]] =
Query.characters {
(Character.name ~ Character.nicknames ~ Character.origin)
.mapN(CharacterView)
}

import sttp.client3._
// run the query and get the result already parsed into a case class
val result = query.toRequest(uri"http://someUrl").send(HttpClientSyncBackend()).body
```
20 changes: 8 additions & 12 deletions src/content/code/language-support/scala/server/caliban.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,26 @@
---
name: Caliban
description: Caliban is a purely functional library for building GraphQL servers and clients in Scala
description: Caliban is a functional library for building GraphQL servers and clients in Scala. It offers minimal boilerplate and excellent interoperability.
url: https://ghostdogpr.github.io/caliban/
github: ghostdogpr/caliban
---

An example of a GraphQL schema and query with `caliban`:
An example of a simple GraphQL schema and query with `caliban`:

```scala
import caliban.GraphQL.graphQL
import caliban.RootResolver

case class Character(name: String, age: Int)

def getCharacters(): List[Character] = ???
import caliban._
import caliban.schema.Schema.auto._

// schema
case class Queries(characters: List[Character])
case class Query(hello: String)

// resolver
val queries = Queries(getCharacters)
val resolver = RootResolver(Query("Hello world!"))

val api = graphQL(RootResolver(queries))
val api = graphQL(resolver)

for {
interpreter <- api.interpreter
result <- interpreter.execute("{ characters { name } }")
result <- interpreter.execute("{ hello }")
} yield result
```

0 comments on commit 60a8453

Please sign in to comment.