-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
split the basic example into basic and with-UDF
- Loading branch information
Showing
10 changed files
with
46 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,3 @@ query allUsers { | |
} | ||
} | ||
} | ||
|
||
query sayHello($name: String!) { | ||
sayHello(name: $name) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*.d.ts | ||
faugra.sdk.ts | ||
package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
This example contains: | ||
|
||
- a User-Defined Function (UDF) [sayHello.fql] | ||
- a Graphql schema [Schema.graphql] | ||
- a Graphql operations document [queries.gql] | ||
|
||
By running `npx faugra --secret <MY_FAUNA_SECRET>` you should expect to see: | ||
|
||
- The UDF uploaded to the cloud | ||
- a TypeScript typings file generated per schema [Schema.d.ts] | ||
- a requests sdk containing all the operations, fully typed and with auto-complete support [faugra.sdk.ts] | ||
|
||
Once your `faugra.sdk.ts` has been generated, you can run `FAUGRA_SECRET=<MY_FAUNA_SECRET> npm start` to see the operations demo. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
type Query { | ||
sayHello(name: String!): String! @resolver(name: "sayHello") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import faugra from './faugra.sdk' | ||
|
||
faugra().sayHello({ name: 'dimension C-137' }).then(console.log) | ||
|
||
// Expected output of this script: | ||
|
||
// { sayHello: 'Hello dimension C-137' } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "faugra-example", | ||
"version": "1.0.0", | ||
"scripts": { | ||
"start": "npx ts-node index.ts" | ||
}, | ||
"dependencies": { | ||
"faugra": "../..", | ||
"graphql-request": "^1.8.2" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^12.12.2", | ||
"ts-node": "^8.8.2", | ||
"typescript": "^3.8.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
query sayHello($name: String!) { | ||
sayHello(name: $name) | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
with-UDF |