├── netlify.toml ├── .gitignore ├── .vscode └── extensions.json ├── netlify-functions ├── boop.js └── create-issue.js ├── host.json ├── package.json ├── issue-azure ├── function.json └── index.js ├── docker-compose.yml └── README.md /netlify.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | functions = "netlify-functions" -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Local Netlify folder 2 | .netlify 3 | local.settings.json 4 | node_modules 5 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "ms-azuretools.vscode-azurefunctions" 4 | ] 5 | } -------------------------------------------------------------------------------- /netlify-functions/boop.js: -------------------------------------------------------------------------------- 1 | exports.handler = async () => { 2 | return { 3 | statusCode: 200, 4 | body: 'boop', 5 | }; 6 | }; 7 | -------------------------------------------------------------------------------- /host.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0", 3 | "logging": { 4 | "applicationInsights": { 5 | "samplingSettings": { 6 | "isEnabled": true, 7 | "excludedTypes": "Request" 8 | } 9 | } 10 | }, 11 | "extensionBundle": { 12 | "id": "Microsoft.Azure.Functions.ExtensionBundle", 13 | "version": "[1.*, 2.0.0)" 14 | } 15 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hasura-api", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "@octokit/rest": "^18.0.0" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /issue-azure/function.json: -------------------------------------------------------------------------------- 1 | { 2 | "bindings": [ 3 | { 4 | "authLevel": "function", 5 | "type": "httpTrigger", 6 | "direction": "in", 7 | "name": "req", 8 | "methods": [ 9 | "get", 10 | "post" 11 | ] 12 | }, 13 | { 14 | "type": "http", 15 | "direction": "out", 16 | "name": "res" 17 | } 18 | ] 19 | } -------------------------------------------------------------------------------- /issue-azure/index.js: -------------------------------------------------------------------------------- 1 | const { Octokit } = require('@octokit/rest'); 2 | const octokit = new Octokit({ 3 | auth: process.env.GITHUB_ACCESS_TOKEN, 4 | }); 5 | 6 | module.exports = async function (context, req) { 7 | const body = req.body; 8 | 9 | const ghResponse = await octokit.issues.create({ 10 | owner: 'jlengstorf', 11 | repo: 'hasura-api', 12 | title: `${body.event.data.new.title} (from Azure Functions)`, 13 | body: body.event.data.new.content, 14 | }); 15 | 16 | console.log(ghResponse); 17 | 18 | context.res = { 19 | body: ghResponse, 20 | }; 21 | }; 22 | -------------------------------------------------------------------------------- /netlify-functions/create-issue.js: -------------------------------------------------------------------------------- 1 | const { Octokit } = require('@octokit/rest'); 2 | const octokit = new Octokit({ 3 | auth: process.env.GITHUB_ACCESS_TOKEN, 4 | }); 5 | 6 | exports.handler = async (event) => { 7 | const body = JSON.parse(event.body); 8 | 9 | const ghResponse = await octokit.issues.create({ 10 | owner: 'jlengstorf', 11 | repo: 'hasura-api', 12 | title: `${body.event.data.new.title} (from Netlify Functions)`, 13 | body: body.event.data.new.content, 14 | }); 15 | 16 | console.log(ghResponse); 17 | 18 | return { 19 | statusCode: 200, 20 | body: JSON.stringify(ghResponse), 21 | }; 22 | }; 23 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.6' 2 | services: 3 | postgres: 4 | image: postgres:12 5 | restart: always 6 | volumes: 7 | - db_data:/var/lib/postgresql/data 8 | environment: 9 | POSTGRES_PASSWORD: postgrespassword 10 | graphql-engine: 11 | image: hasura/graphql-engine:v1.2.2 12 | ports: 13 | - '8080:8080' 14 | depends_on: 15 | - 'postgres' 16 | restart: always 17 | environment: 18 | HASURA_GRAPHQL_DATABASE_URL: postgres://postgres:postgrespassword@postgres:5432/postgres 19 | HASURA_GRAPHQL_ENABLE_CONSOLE: 'true' # set to "false" to disable console 20 | HASURA_GRAPHQL_ENABLED_LOG_TYPES: startup, http-log, webhook-log, websocket-log, query-log 21 | ## uncomment next line to set an admin secret 22 | # HASURA_GRAPHQL_ADMIN_SECRET: myadminsecretkey 23 | volumes: 24 | db_data: 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
13 | But don’t worry! You can still: 14 | watch the video · 15 | deploy this project · 16 | see upcoming episodes 17 |
18 | 19 | 20 | 21 | In this episode, Christian Nwamba teaches us how we can build incredibly powerful apps without the overhead of managing lots of infrastructure by combining Hasura, serverless functions, and the Jamstack. 22 | 23 | 24 | 25 | ## More Information 26 | 27 | - [Watch this app get built live + see links and additional resources][episode] 28 | - [Follow _Learn With Jason_ on Twitch][twitch] to watch future episodes live 29 | - [Add the _Learn With Jason_ schedule to your Google Calendar][cal] 30 | 31 | 32 | [episode]: https://www.learnwithjason.dev/serverless-graphql-with-hasura 33 | [twitch]: https://jason.af/twitch 34 | [cal]: https://jason.af/lwj/cal --------------------------------------------------------------------------------