{"id":22299,"date":"2021-03-01T17:04:40","date_gmt":"2021-03-01T17:04:40","guid":{"rendered":"http:\/\/dynamically_fetch_data_in_jamstack_sites_with_hasura"},"modified":"2022-02-25T18:25:28","modified_gmt":"2022-02-25T18:25:28","slug":"dynamically_fetch_data_in_jamstack_sites_with_hasura","status":"publish","type":"post","link":"https:\/\/cloudinary.com\/blog\/dynamically_fetch_data_in_jamstack_sites_with_hasura","title":{"rendered":"Dynamically Fetch Data in Jamstack Sites With Hasura"},"content":{"rendered":"<div class=\"wp-block-cloudinary-markdown \"><p>The <a href=\"https:\/\/cloudinary.com\/blog\/developer_experience_for_a_modern_web_jamstack_delivers\">Jamstack<\/a> web-development architecture yields many benefits, including high performance and security. Plus, thanks to its APIs, which function as software as a service (SaaS), no back-end infrastructure is required for web applications.<\/p>\n<p>The rise of platforms as a service (a type of SAAS) has rewarded the front end with a lot of autonomy. Even though Jamstack front ends are mostly associated with static site generators like Next.js, Gatsby, and Nuxt.js, I strongly believe that any application that contains a self-sustainable front end and that leverages APIs for specific purposes qualifies as a Jamstack front end. So, it can be a simple project coded with HTML, CSS, and logic.<\/p>\n<p>Many front-end developers relish building stand-alone applications but must answer several questions at the outset, such as where to get the related data and how to authenticate it. Above all, if a PostgreSQL database already exists, how to connect it to the new Jamstack front end? <a href=\"http:\/\/Hasura.io\">Hasura.io<\/a> is a silver bullet of a solution.<\/p>\n<h2>Understanding Hasura<\/h2>\n<p>As defined on GitHub, Hasura is a superfast GraphQL server that \u201cgives you instant, real-time GraphQL APIs over Postgres, with webhook triggers on database events and remote schemas for business logic.\u201d You want to give the front end all the autonomy it needs, e.g., where to source data and how to structure and handle that data.<\/p>\n<div class='c-callout  c-callout--inline-title c-callout--note'><strong class='c-callout__title'>Note:<\/strong> <p>Data in Jamstack applications can usually originate from any source, e.g., one or multiple content management systems, assuming that you\u2019re using a framework like Gatsby or connecting to an existing database like Postgres with Hasura.<\/p><\/div>\n<p>Below is a demo that shows you how to use Hasura to connect and fetch data to an application built with HTML.<\/p>\n<h2>Setting Up Hasura<\/h2>\n<ol>\n<li>Create a <a href=\"https:\/\/cloud.hasura.io\/\">Hasura<\/a> account and sign in.<\/li>\n<li>Click <strong>Try a free database with Heroku<\/strong>.<\/li>\n<\/ol>\n<p><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/image\/upload\/w_700,c_fill,f_auto,q_auto,dpr_2.0\/Web_Assets\/blog\/hasura_sign_up.png\" alt=\"Sign up for Hasura\" loading=\"lazy\" class=\"c-transformed-asset\"  width=\"1400\" height=\"1169\"\/><\/p>\n<p>Next, click the <strong>DATA<\/strong> tab at the top and then click <strong>Create Table<\/strong>.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/image\/upload\/w_500,c_fill,f_auto,q_auto\/Web_Assets\/blog\/graphql_schema.png\" alt=\"GraphQL Schema\" loading=\"lazy\" class=\"c-transformed-asset\"  width=\"500\" height=\"423\"\/><\/p>\n<p>Assign types to your parameters, that is, define the data you want your queries to return on the front end and the data types.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/image\/upload\/w_500,c_fill,f_auto,q_auto\/Web_Assets\/blog\/graphql_data.png\" alt=\"GraphQL data\" loading=\"lazy\" class=\"c-transformed-asset\"  width=\"500\" height=\"404\"\/><\/p>\n<h2>Connecting Hasura to Applications With Utility Functions<\/h2>\n<p>Now connect the database to the sample application with the following:<\/p>\n<ul>\n<li>\n<strong>Two environment variables<\/strong>, which link your Hasura account and database with your application so that you can query for data from there.<\/li>\n<li>\n<strong>A utility function<\/strong>, which enables interactivity in the application.<\/li>\n<li>\n<strong>A serverless function<\/strong>. For an explanation of this function type, see the post <a href=\"https:\/\/cloudinary.com\/blog\/implement_dynamism_in_static_sites_with_serverless_functions\"><em>Serverless Functions Deliver Dynamism to Static Sites<\/em><\/a>.<\/li>\n<\/ul>\n<p>Do the following:<\/p>\n<ol>\n<li>\n<p>Log in to Hasura cloud and go to <code>https:\/\/cloud.hasura.io\/projects<\/code>.<\/p>\n<\/li>\n<li>\n<p>Note the values of the two environment variables: <code>HASURA_API_URL<\/code> and <code>HASURA_ADMIN_SECRET<\/code>.<\/p>\n<pre class=\"js-syntax-highlighted\"><code>HASURA_API_URL = xxxxxx\nHASURA_ADMIN_SECRET = xxxxxx \n<\/code><\/pre>\n<\/li>\n<li>\n<p>Create a <code>functions<\/code> directory in the root of the application with a folder called <code>utils.js<\/code>, in which in turn create a file called <code>hasura.js<\/code> that contains the code below. Be sure to replace <code>HASSURA_API_URL<\/code> and <code>HASURA_ADMIN_SECRET<\/code> with their values.<\/p>\n<\/li>\n<\/ol>\n<pre class=\"js-syntax-highlighted\"><code>const fetch = require('node-fetch')\nasync function query({query,variables = {}}) {\n    const result  =await fetch(process.env.HASURA_API_URL,{\n        method: 'POST',\n        headers: {\n            'Content-type':'application\/json',\n            'X-Hasura-Admin-Secret': process.env.HASURA_ADMIN_SECRET,\n        },\n        body:JSON.stringify({query,variables}),\n    })\n    .then((response)=&gt; response.json());\n    \n    \/\/To do: check for errors and show errors\nreturn result.data\n     \n}\nexports.query = query \n<\/code><\/pre>\n<p>The above code posts queries to your Hasura workspace with the <code>fetch<\/code> API and then exports a <code>query<\/code> function with which you can extract data from your database.<\/p>\n<h2>Querying for Data in Components<\/h2>\n<p>Finally, connect a query to the application with a Netlify serverless function. In the <code>functions<\/code> directory, create a file called add-project.js with the code below, which imports the <code>query<\/code> function that enables you to write the GraphQL query generated in Hasura.<\/p>\n<pre class=\"js-syntax-highlighted\"><code>const { query } = require(&quot;.\/util\/hasura&quot;);\nexports.handler = async (event) =&gt; {\n    const result = await query({\n        query: `\n        query {\n          projects {\n              id\n              project\n              tagline\n              title\n                }\n            }\n        `\n    })\n    return{\n        statusCode:200,\n        body:JSON.stringify(result),\n    };\n    \n}; \n<\/code><\/pre>\n<h2>Extracting Data in a Form With the Serverless Function<\/h2>\n<p>You can now use the serverless function to get data from a form. See the code below. Once the body is posted, it sends several parameters (<code>id<\/code>, <code>title<\/code>, etc.) to the serverless function for a response.<\/p>\n<pre class=\"js-syntax-highlighted\"><code>async function handleSubmit(event) {\n    event.preventDefault(); \/\/ stops the submit from firing before the function runs \n  const data = new FormData(event.target); \/\/formdata API\n  const result = await fetch('\/.netlify\/functions\/add-project', {\n    method :'POST',\n      body: JSON.stringify({\n        id: data.get('id'),\n        title: data.get('title'),\n        tagline: data.get('tagline'),\n        project: data.get('project'),\n      }),\n  }).then((response) =&gt; {\n      document.querySelector(\n        '.message',\n        ).innerText = `Response: ${response.status}`;\n    });\n}\n<\/code><\/pre>\n<h2>Getting Uniform Images From the Form<\/h2>\n<p>For a consistent display, you\u2019d want the images in the forms to have the same resolutions before being stored in your Cloudinary account\u2019s Media Library in Cloudinary-generated URLs. Toward that end, leverage the Cloudinary capability called incoming transformations, which modifies images during or after their upload.<\/p>\n<p>Do the following:<\/p>\n<ol>\n<li>\n<p>From your Cloudinary account\u2019s dashboard, grab your Cloudinary name, API key, and API secret and store them as environment variables in a file called <code>.env<\/code> (see the example below) in the project\u2019s root directory.<\/p>\n<pre class=\"js-syntax-highlighted\"><code>CLOUDINARY_NAME=my-project\nCLOUDINARY_API_KEY=xxxxxxxxxxxxxxxxxx\nCLOUDINARY_API_SECRET=xxxxxxxxxxxxxxxxxxxxx\n<\/code><\/pre>\n<\/li>\n<li>\n<p>Create a utility function with the code below. Be sure to replace <code>LOUDINARY_NAME<\/code>, <code>CLOUDINARY_API_KEY<\/code>, and <code>CLOUDINARY_API_SECRET<\/code> with their values.<\/p>\n<\/li>\n<\/ol>\n<pre class=\"js-syntax-highlighted\"><code>const cloudinary = require(&quot;cloudinary&quot;).v2;\nconst dotenv = require(&quot;dotenv&quot;);\ndotenv.config();\n\ncloudinary.config({\n  cloud_name: process.env.CLOUDINARY_NAME,\n  api_key: process.env.CLOUDINARY_API_KEY,\n  api_secret: process.env.CLOUDINARY_API_SECRET\n});\n\n\/\/ When doing a signed upload, you'll use a function like this one:\nexports.handler = async event =&gt; {\n  const { project } = JSON.parse(event.body);\n  const res = await cloudinary.v2.uploader.upload(project, { width: 2000, height: 1000, crop: &quot;limit&quot; },\n  function(error, result) { console.log(result, error); });\n  return {\n    statusCode: 200,\n    body: JSON.stringify(res)\n  };\n};\n<\/code><\/pre>\n<p>This function adds a preset, which limits the dimensions of an uploaded image to a maximum width of 2,000 pixels and a maximum height of 1,000 pixels.<\/p>\n<p>You can apply more transformations to the uploaded images or generate assets derived from the originals with other Cloudinary features, such as <a href=\"https:\/\/cloudinary.com\/documentation\/transformations_on_upload\">eager transformation<\/a>.<\/p>\n<h2>Opening the Door to Dynamism<\/h2>\n<p>With Hasura, you can build numerous dynamic capabilities for <a href=\"https:\/\/cloudinary.com\/blog\/developer_experience_for_a_modern_web_jamstack_delivers\">Jamstack<\/a> sites. Let your creativity soar!<\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"","protected":false},"author":41,"featured_media":22300,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_cloudinary_featured_overwrite":false,"footnotes":""},"categories":[1],"tags":[25,175],"class_list":["post-22299","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-asset-management","tag-jamstack"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.6 (Yoast SEO v26.9) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>How to Dynamically Fetch Data in Jamstack Sites With Hasura<\/title>\n<meta name=\"description\" content=\"To dynamically fetch data, including transformed images in Cloudinary, to Jamstack sites, connect a database with environment variables and functions.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/cloudinary.com\/blog\/dynamically_fetch_data_in_jamstack_sites_with_hasura\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Dynamically Fetch Data in Jamstack Sites With Hasura\" \/>\n<meta property=\"og:description\" content=\"To dynamically fetch data, including transformed images in Cloudinary, to Jamstack sites, connect a database with environment variables and functions.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/cloudinary.com\/blog\/dynamically_fetch_data_in_jamstack_sites_with_hasura\" \/>\n<meta property=\"og:site_name\" content=\"Cloudinary Blog\" \/>\n<meta property=\"article:published_time\" content=\"2021-03-01T17:04:40+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-02-25T18:25:28+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/cloudinary.com\/blog\/wp-content\/uploads\/sites\/12\/2022\/02\/Fetch-data-Jamstack-Hasura.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1540\" \/>\n\t<meta property=\"og:image:height\" content=\"847\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"NewsArticle\",\"@id\":\"https:\/\/cloudinary.com\/blog\/dynamically_fetch_data_in_jamstack_sites_with_hasura#article\",\"isPartOf\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/dynamically_fetch_data_in_jamstack_sites_with_hasura\"},\"author\":{\"name\":\"\",\"@id\":\"\"},\"headline\":\"Dynamically Fetch Data in Jamstack Sites With Hasura\",\"datePublished\":\"2021-03-01T17:04:40+00:00\",\"dateModified\":\"2022-02-25T18:25:28+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/dynamically_fetch_data_in_jamstack_sites_with_hasura\"},\"wordCount\":8,\"publisher\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/dynamically_fetch_data_in_jamstack_sites_with_hasura#primaryimage\"},\"thumbnailUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649719438\/Web_Assets\/blog\/Fetch-data-Jamstack-Hasura_22300d57b9\/Fetch-data-Jamstack-Hasura_22300d57b9.png?_i=AA\",\"keywords\":[\"Asset Management\",\"JAMStack\"],\"inLanguage\":\"en-US\",\"copyrightYear\":\"2021\",\"copyrightHolder\":{\"@id\":\"https:\/\/cloudinary.com\/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/cloudinary.com\/blog\/dynamically_fetch_data_in_jamstack_sites_with_hasura\",\"url\":\"https:\/\/cloudinary.com\/blog\/dynamically_fetch_data_in_jamstack_sites_with_hasura\",\"name\":\"How to Dynamically Fetch Data in Jamstack Sites With Hasura\",\"isPartOf\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/dynamically_fetch_data_in_jamstack_sites_with_hasura#primaryimage\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/dynamically_fetch_data_in_jamstack_sites_with_hasura#primaryimage\"},\"thumbnailUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649719438\/Web_Assets\/blog\/Fetch-data-Jamstack-Hasura_22300d57b9\/Fetch-data-Jamstack-Hasura_22300d57b9.png?_i=AA\",\"datePublished\":\"2021-03-01T17:04:40+00:00\",\"dateModified\":\"2022-02-25T18:25:28+00:00\",\"description\":\"To dynamically fetch data, including transformed images in Cloudinary, to Jamstack sites, connect a database with environment variables and functions.\",\"breadcrumb\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/dynamically_fetch_data_in_jamstack_sites_with_hasura#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/cloudinary.com\/blog\/dynamically_fetch_data_in_jamstack_sites_with_hasura\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cloudinary.com\/blog\/dynamically_fetch_data_in_jamstack_sites_with_hasura#primaryimage\",\"url\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649719438\/Web_Assets\/blog\/Fetch-data-Jamstack-Hasura_22300d57b9\/Fetch-data-Jamstack-Hasura_22300d57b9.png?_i=AA\",\"contentUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649719438\/Web_Assets\/blog\/Fetch-data-Jamstack-Hasura_22300d57b9\/Fetch-data-Jamstack-Hasura_22300d57b9.png?_i=AA\",\"width\":1540,\"height\":847},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/cloudinary.com\/blog\/dynamically_fetch_data_in_jamstack_sites_with_hasura#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/cloudinary.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Dynamically Fetch Data in Jamstack Sites With Hasura\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#website\",\"url\":\"https:\/\/cloudinary.com\/blog\/\",\"name\":\"Cloudinary Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/cloudinary.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#organization\",\"name\":\"Cloudinary Blog\",\"url\":\"https:\/\/cloudinary.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA\",\"contentUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA\",\"width\":312,\"height\":60,\"caption\":\"Cloudinary Blog\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to Dynamically Fetch Data in Jamstack Sites With Hasura","description":"To dynamically fetch data, including transformed images in Cloudinary, to Jamstack sites, connect a database with environment variables and functions.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/cloudinary.com\/blog\/dynamically_fetch_data_in_jamstack_sites_with_hasura","og_locale":"en_US","og_type":"article","og_title":"Dynamically Fetch Data in Jamstack Sites With Hasura","og_description":"To dynamically fetch data, including transformed images in Cloudinary, to Jamstack sites, connect a database with environment variables and functions.","og_url":"https:\/\/cloudinary.com\/blog\/dynamically_fetch_data_in_jamstack_sites_with_hasura","og_site_name":"Cloudinary Blog","article_published_time":"2021-03-01T17:04:40+00:00","article_modified_time":"2022-02-25T18:25:28+00:00","og_image":[{"width":1540,"height":847,"url":"http:\/\/cloudinary.com\/blog\/wp-content\/uploads\/sites\/12\/2022\/02\/Fetch-data-Jamstack-Hasura.png","type":"image\/png"}],"twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"NewsArticle","@id":"https:\/\/cloudinary.com\/blog\/dynamically_fetch_data_in_jamstack_sites_with_hasura#article","isPartOf":{"@id":"https:\/\/cloudinary.com\/blog\/dynamically_fetch_data_in_jamstack_sites_with_hasura"},"author":{"name":"","@id":""},"headline":"Dynamically Fetch Data in Jamstack Sites With Hasura","datePublished":"2021-03-01T17:04:40+00:00","dateModified":"2022-02-25T18:25:28+00:00","mainEntityOfPage":{"@id":"https:\/\/cloudinary.com\/blog\/dynamically_fetch_data_in_jamstack_sites_with_hasura"},"wordCount":8,"publisher":{"@id":"https:\/\/cloudinary.com\/blog\/#organization"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/dynamically_fetch_data_in_jamstack_sites_with_hasura#primaryimage"},"thumbnailUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649719438\/Web_Assets\/blog\/Fetch-data-Jamstack-Hasura_22300d57b9\/Fetch-data-Jamstack-Hasura_22300d57b9.png?_i=AA","keywords":["Asset Management","JAMStack"],"inLanguage":"en-US","copyrightYear":"2021","copyrightHolder":{"@id":"https:\/\/cloudinary.com\/#organization"}},{"@type":"WebPage","@id":"https:\/\/cloudinary.com\/blog\/dynamically_fetch_data_in_jamstack_sites_with_hasura","url":"https:\/\/cloudinary.com\/blog\/dynamically_fetch_data_in_jamstack_sites_with_hasura","name":"How to Dynamically Fetch Data in Jamstack Sites With Hasura","isPartOf":{"@id":"https:\/\/cloudinary.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/cloudinary.com\/blog\/dynamically_fetch_data_in_jamstack_sites_with_hasura#primaryimage"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/dynamically_fetch_data_in_jamstack_sites_with_hasura#primaryimage"},"thumbnailUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649719438\/Web_Assets\/blog\/Fetch-data-Jamstack-Hasura_22300d57b9\/Fetch-data-Jamstack-Hasura_22300d57b9.png?_i=AA","datePublished":"2021-03-01T17:04:40+00:00","dateModified":"2022-02-25T18:25:28+00:00","description":"To dynamically fetch data, including transformed images in Cloudinary, to Jamstack sites, connect a database with environment variables and functions.","breadcrumb":{"@id":"https:\/\/cloudinary.com\/blog\/dynamically_fetch_data_in_jamstack_sites_with_hasura#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cloudinary.com\/blog\/dynamically_fetch_data_in_jamstack_sites_with_hasura"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudinary.com\/blog\/dynamically_fetch_data_in_jamstack_sites_with_hasura#primaryimage","url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649719438\/Web_Assets\/blog\/Fetch-data-Jamstack-Hasura_22300d57b9\/Fetch-data-Jamstack-Hasura_22300d57b9.png?_i=AA","contentUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649719438\/Web_Assets\/blog\/Fetch-data-Jamstack-Hasura_22300d57b9\/Fetch-data-Jamstack-Hasura_22300d57b9.png?_i=AA","width":1540,"height":847},{"@type":"BreadcrumbList","@id":"https:\/\/cloudinary.com\/blog\/dynamically_fetch_data_in_jamstack_sites_with_hasura#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/cloudinary.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Dynamically Fetch Data in Jamstack Sites With Hasura"}]},{"@type":"WebSite","@id":"https:\/\/cloudinary.com\/blog\/#website","url":"https:\/\/cloudinary.com\/blog\/","name":"Cloudinary Blog","description":"","publisher":{"@id":"https:\/\/cloudinary.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/cloudinary.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/cloudinary.com\/blog\/#organization","name":"Cloudinary Blog","url":"https:\/\/cloudinary.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA","contentUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA","width":312,"height":60,"caption":"Cloudinary Blog"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":""}]}},"jetpack_featured_media_url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649719438\/Web_Assets\/blog\/Fetch-data-Jamstack-Hasura_22300d57b9\/Fetch-data-Jamstack-Hasura_22300d57b9.png?_i=AA","_links":{"self":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/22299","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/users\/41"}],"replies":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/comments?post=22299"}],"version-history":[{"count":2,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/22299\/revisions"}],"predecessor-version":[{"id":22815,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/22299\/revisions\/22815"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/media\/22300"}],"wp:attachment":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/media?parent=22299"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/categories?post=22299"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/tags?post=22299"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}