{"id":2984,"date":"2021-05-27T08:48:00","date_gmt":"2021-05-26T20:48:00","guid":{"rendered":"https:\/\/www.talkcrypto.org\/blog\/?p=2984"},"modified":"2023-11-28T01:24:42","modified_gmt":"2023-11-27T12:24:42","slug":"hosting-a-subql-project-in-less-than-5-mins","status":"publish","type":"post","link":"https:\/\/www.talkcrypto.org\/blog\/2021\/05\/27\/hosting-a-subql-project-in-less-than-5-mins\/","title":{"rendered":"Hosting a Subql project in less than 5 mins"},"content":{"rendered":"\n<p><\/p>\n\n\n\n<p>SubQuery provides a very convenient service where you can host your projects for free and the best part about it is that you can get it up and running in less than 5 minutes. <\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Pre-requisites<\/h1>\n\n\n\n<p>You will have wanted to have gone through the <a rel=\"noreferrer noopener\" href=\"https:\/\/www.talkcrypto.org\/blog\/2021\/05\/04\/part-1-subql-hello-world-in-less-than-5-mins\/\" target=\"_blank\">Part 1: Subql Hello World in less than 5 mins<\/a> tutorial first because tutorial is exactly the same except for the last step. Instead of running the query in Docker, we will run it in SubQuery. <\/p>\n\n\n\n<p>You will also need a GitHub account and have pushed your code to a repository. This is because SubQuery will read your code from GitHub.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Set up GitHub<\/h2>\n\n\n\n<p>Log into your GitHub account and create a repository by clicking on &#8220;new&#8221; in the repository tab. <\/p>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"153\" src=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-40-1024x153.png\" alt=\"\" class=\"wp-image-2985\" srcset=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-40-1024x153.png 1024w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-40-300x45.png 300w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-40-768x115.png 768w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-40-1536x229.png 1536w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-40.png 1956w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Provide a repo name and choose your visibility and initialisation preference. I&#8217;ve left everything as the default for now. <\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img decoding=\"async\" src=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-41-1024x1019.png\" alt=\"\" class=\"wp-image-2986\" width=\"510\" height=\"507\" srcset=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-41-1024x1019.png 1024w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-41-300x298.png 300w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-41-150x150.png 150w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-41-768x764.png 768w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-41.png 1518w\" sizes=\"(max-width: 510px) 100vw, 510px\" \/><\/figure><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>Then hit &#8220;Create repository&#8221;.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"598\" src=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-42-1024x598.png\" alt=\"\" class=\"wp-image-2987\" srcset=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-42-1024x598.png 1024w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-42-300x175.png 300w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-42-768x449.png 768w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-42-1536x898.png 1536w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-42-2048x1197.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Once you have this repository, we&#8217;ll create our template starter project and push it to this repo. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Create your project<\/h2>\n\n\n\n<p>Next, let&#8217;s create a starter project template with the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>subql init --starter subql_helloworld!<\/code><\/pre>\n\n\n\n<p>You don&#8217;t have to make the project name the same as the repository name but I find that it helps. Then run the obligatory install, codegen and build.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>yarn install\nyarn codegen\nyarn build<\/code><\/pre>\n\n\n\n<p>Do NOT run the Docker commands. Note, if you are not familiar with the above, please check out <a rel=\"noreferrer noopener\" href=\"https:\/\/www.talkcrypto.org\/blog\/2021\/05\/04\/part-1-subql-hello-world-in-less-than-5-mins\/\" target=\"_blank\">Part 1: Subql Hello World in less than 5 mins<\/a> and <a rel=\"noreferrer noopener\" href=\"https:\/\/www.talkcrypto.org\/blog\/2021\/05\/07\/part-2-understanding-subql-hello-world\/\" target=\"_blank\">Part 2: Understanding Subql Hello World in more depth<\/a> first.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Push your code to GitHub<\/h2>\n\n\n\n<p>Now comes the fun part. You will have to push your code to GitHub. You can do this in several ways. Either with command line or your favourite Git client such as <a rel=\"noreferrer noopener\" href=\"https:\/\/www.sourcetreeapp.com\/\" target=\"_blank\">Sourcetree<\/a> or <a rel=\"noreferrer noopener\" href=\"https:\/\/git-fork.com\/\" target=\"_blank\">Fork<\/a>. I&#8217;ll use command line here. <\/p>\n\n\n\n<p>In your subql_helloworld directory, if you run any git command such as git push or git remote, you&#8217;ll get this error:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>~\/Code\/subQuery\/subql_helloworld$ git remote\nfatal: not a git repository (or any of the parent directories): .git<\/code><\/pre>\n\n\n\n<p>This is because git does not recognise this directory. To fix this error, let&#8217;s initialise this directory with the command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git init<\/code><\/pre>\n\n\n\n<p>Now if you run git remote, nothing will happen but your error should have disappeared. <\/p>\n\n\n\n<p>Next you want to add a remote repository by running:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git remote add origin https:\/\/github.com\/seandotau\/subql_helloworld.git<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"601\" src=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-27-at-7.33.31-am-1024x601.png\" alt=\"\" class=\"wp-image-2990\" srcset=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-27-at-7.33.31-am-1024x601.png 1024w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-27-at-7.33.31-am-300x176.png 300w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-27-at-7.33.31-am-768x451.png 768w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-27-at-7.33.31-am-1536x901.png 1536w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-27-at-7.33.31-am-2048x1201.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>This basically sets your remote repository to &#8220;https:\/\/github.com\/seandotau\/subql_helloworld.git&#8221; and gives it the name &#8220;origin&#8221; which is the standard nomenclature for a remote repository in GitHub.<\/p>\n\n\n\n<p>Running git remote again should show the following:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>~\/Code\/subQuery\/subql_helloworld$ git remote\norigin<\/code><\/pre>\n\n\n\n<p>Now let&#8217;s create a branch called main. Sometimes this is referred to as &#8220;master&#8221; but we&#8217;ll use the GitHub terminology here.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git branch -M main<\/code><\/pre>\n\n\n\n<p>Now, if you try and run git push -u origin main you&#8217;ll most likely get the following error:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>~\/Code\/subQuery\/subql_helloworld$ git push origin main\nerror: src refspec main does not match any.\nerror: failed to push some refs to 'https:\/\/github.com\/seandotau\/subql_helloworld.git'<\/code><\/pre>\n\n\n\n<p>This will be because we have not committed anything to our local repository. Let&#8217;s run:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git add . \/\/ this adds everything to our local git repo\ngit commit -m \"Our first commit\" \/\/ commit to our local repo with a comment.<\/code><\/pre>\n\n\n\n<p>Now you can run git push origin main. This means please push my code TO the origin repo FROM my main local repo.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>~\/Code\/subQuery\/subql_helloworld$ git push origin main\nEnumerating objects: 14, done.\nCounting objects: 100% (14\/14), done.\nDelta compression using up to 12 threads\nCompressing objects: 100% (13\/13), done.\nWriting objects: 100% (14\/14), 59.35 KiB | 8.48 MiB\/s, done.\nTotal 14 (delta 0), reused 0 (delta 0)\nTo https:\/\/github.com\/seandotau\/subql_helloworld.git\n * &#91;new branch]      main -&gt; main\n<\/code><\/pre>\n\n\n\n<p>Now if you refresh your GitHub repo, you should see code!<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"568\" src=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-43-1024x568.png\" alt=\"\" class=\"wp-image-2991\" srcset=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-43-1024x568.png 1024w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-43-300x167.png 300w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-43-768x426.png 768w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-43-1536x853.png 1536w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-43-2048x1137.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Now that you have got your code into GitHub, we can start the real tutorial! \ud83d\ude42<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Hosting a SubQuery project in SubQuery<\/h1>\n\n\n\n<p>As mentioned here, very often it&#8217;s the preparation that takes the most time. The actual &#8220;cooking&#8221; is quick. So let&#8217;s start cooking!<\/p>\n\n\n\n<p>Navigate to https:\/\/project.subquery.network\/ and log in.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-45-1024x376.png\" alt=\"\" class=\"wp-image-2993\" width=\"747\" height=\"274\" srcset=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-45-1024x376.png 1024w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-45-300x110.png 300w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-45-768x282.png 768w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-45-1536x563.png 1536w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-45.png 1958w\" sizes=\"(max-width: 747px) 100vw, 747px\" \/><\/figure><\/div>\n\n\n\n<p>Then click &#8220;Create Project&#8221;. <\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-47.png\" alt=\"\" class=\"wp-image-2995\" width=\"318\" height=\"500\" srcset=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-47.png 602w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-47-191x300.png 191w\" sizes=\"(max-width: 318px) 100vw, 318px\" \/><\/figure><\/div>\n\n\n\n<p>Now you&#8217;ll want to fill in the various information. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"730\" src=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-49-1024x730.png\" alt=\"\" class=\"wp-image-2997\" srcset=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-49-1024x730.png 1024w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-49-300x214.png 300w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-49-768x547.png 768w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-49-1536x1094.png 1536w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-49.png 1690w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Then deploy a slot. Here we choose production, but it could also be staging as well. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"592\" src=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-27-at-7.55.11-am-1024x592.png\" alt=\"\" class=\"wp-image-2999\" srcset=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-27-at-7.55.11-am-1024x592.png 1024w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-27-at-7.55.11-am-300x173.png 300w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-27-at-7.55.11-am-768x444.png 768w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-27-at-7.55.11-am-1536x888.png 1536w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-27-at-7.55.11-am-2048x1183.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Then you can choose more options. <\/p>\n\n\n\n<p>Commit Hash of new Version: This allows you to choose which version in your GitHub you wish to deploy. We only have 1 version here so the dropdown doesn&#8217;t contain any other version. <\/p>\n\n\n\n<p>Indexer Version and Query Version we&#8217;ll leave as default but typically if you want to run your project against a specific older version, you can. Then hit deploy update.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"442\" height=\"427\" src=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-51.png\" alt=\"\" class=\"wp-image-3000\" srcset=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-51.png 442w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-51-300x290.png 300w\" sizes=\"(max-width: 442px) 100vw, 442px\" \/><\/figure><\/div>\n\n\n\n<p>You&#8217;ll then see your deployment in &#8220;Processing&#8221; status. Here, your code is getting deployed onto the SubQuery infrastructure. Basically a server is getting spun up on demand and being provisioned for you. This will take a few minutes so time to grab a coffee!<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-52-1024x582.png\" alt=\"\" class=\"wp-image-3001\" width=\"655\" height=\"372\" srcset=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-52-1024x582.png 1024w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-52-300x170.png 300w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-52-768x436.png 768w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-52.png 1046w\" sizes=\"(max-width: 655px) 100vw, 655px\" \/><\/figure><\/div>\n\n\n\n<h1 class=\"wp-block-heading\">Testing your hosted SubQuery deployment<\/h1>\n\n\n\n<p>After a few minutes, you should see your status as &#8220;running&#8221;. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"552\" src=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-53-1024x552.png\" alt=\"\" class=\"wp-image-3002\" srcset=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-53-1024x552.png 1024w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-53-300x162.png 300w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-53-768x414.png 768w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-53.png 1102w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Now comes the tricky part. You need to click on the 3 ellipses and select &#8220;View on SubQuery Explorer&#8221;. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"391\" src=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-55-1024x391.png\" alt=\"\" class=\"wp-image-3004\" srcset=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-55-1024x391.png 1024w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-55-300x115.png 300w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-55-768x293.png 768w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-55.png 1068w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>This then takes you to the familiar &#8220;Playground&#8221; where if you hit the &#8220;play&#8221; button you should see some results returned. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"470\" src=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-27-at-8.06.04-am-1024x470.png\" alt=\"\" class=\"wp-image-3007\" srcset=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-27-at-8.06.04-am-1024x470.png 1024w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-27-at-8.06.04-am-300x138.png 300w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-27-at-8.06.04-am-768x352.png 768w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-27-at-8.06.04-am-1536x705.png 1536w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-27-at-8.06.04-am-2048x940.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>There is also a neat status section which shows the total entities, the number of entities synced and the % of synching complete<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"194\" src=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-27-at-8.06.11-am-1024x194.png\" alt=\"\" class=\"wp-image-3008\" srcset=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-27-at-8.06.11-am-1024x194.png 1024w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-27-at-8.06.11-am-300x57.png 300w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-27-at-8.06.11-am-768x145.png 768w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-27-at-8.06.11-am-1536x291.png 1536w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/Screen-Shot-2021-06-27-at-8.06.11-am-2048x388.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h1 class=\"wp-block-heading\">Extra bonus<\/h1>\n\n\n\n<p>For those of you who might be wondering how to integrate this to your front end, you may have noticed in the  Deployment Details section that you have a &#8220;Query Endpoint&#8221;. For me it was: https:\/\/api.subquery.network\/sq\/seandotau\/helloworld. (It is also displayed in the playgrounds page).<\/p>\n\n\n\n<p>This endpoint will allow you to write a GET query to fetch the data. To do this, take the query from your playground, ie<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>query {\n    starterEntities (first: 5, orderBy: CREATED_AT_DESC) {\n        totalCount\n        nodes {\n            id\n        }\n    }\n}<\/code><\/pre>\n\n\n\n<p>and paste it into an application like Postman.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"898\" height=\"623\" src=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-58.png\" alt=\"\" class=\"wp-image-3009\" srcset=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-58.png 898w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-58-300x208.png 300w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/image-58-768x533.png 768w\" sizes=\"(max-width: 898px) 100vw, 898px\" \/><\/figure>\n\n\n\n<p>You can also use cURL via command line as well. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>~\/Code\/subQuery\/subql_helloworld$ curl https:\/\/api.subquery.network\/sq\/seandotau\/helloworld -d \"query=query {\n&gt;     starterEntities (first: 5, orderBy: CREATED_AT_DESC) {\n&gt;         totalCount\n&gt;         nodes {\n&gt;             id\n&gt;         }\n&gt;     }\n&gt; }\"\n{\"data\":{\"starterEntities\":{\"totalCount\":27388,\"nodes\":&#91;{\"id\":\"0xffdcf133349354ce2ac53a4bee4941863e5cc378aed3c2425284dc070b9368a4\"},{\"id\":\"0x531b88d92db3fd03e9840680496978619c0dfa8225caa23c8aa2754215494804\"},{\"id\":\"0x9b1d7d32c7b282b53cde2f4ff847c3ad1aec1e0004fe784d8f40f8ae87767f96\"},{\"id\":\"0x1f3994816bda3f26aff4abca5c5aa8ec3ec3d6e3d967790ec040d65e97ba49da\"},{\"id\":\"0xa2560f7607acce5502242161428b23f40ec369174a91cb07c13d18507d80996b\"}]}}}\n<\/code><\/pre>\n\n\n\n<p>What I like to do is to make it look tidier by formatting it to one line. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>query { starterEntities (first: 5, orderBy: CREATED_AT_DESC) { totalCount nodes { id } } }<\/code><\/pre>\n\n\n\n<p>A neat trick I do is to copy this into VS Code and then &#8220;join lines&#8221;. Basically ctrl+J on a Mac. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>SubQuery provides a very convenient service where you can host<\/p>\n","protected":false},"author":1,"featured_media":3423,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-2984","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blockchain"],"featured_image_urls":{"full":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/subquery.png",1800,773,false],"thumbnail":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/subquery-150x150.png",150,150,true],"medium":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/subquery-300x129.png",300,129,true],"medium_large":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/subquery-768x330.png",640,275,true],"large":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/subquery-1024x440.png",640,275,true],"1536x1536":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/subquery-1536x660.png",1536,660,true],"2048x2048":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/subquery.png",1800,773,false],"chromenews-featured":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/subquery-1024x440.png",1024,440,true],"chromenews-large":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/subquery-825x575.png",825,575,true],"chromenews-medium":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2021\/06\/subquery-590x410.png",590,410,true]},"author_info":{"info":["seandotau"]},"category_info":"<a href=\"https:\/\/www.talkcrypto.org\/blog\/category\/blockchain\/\" rel=\"category tag\">Blockchain<\/a>","tag_info":"Blockchain","comment_count":"0","_links":{"self":[{"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/posts\/2984","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/comments?post=2984"}],"version-history":[{"count":2,"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/posts\/2984\/revisions"}],"predecessor-version":[{"id":3011,"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/posts\/2984\/revisions\/3011"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/media\/3423"}],"wp:attachment":[{"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/media?parent=2984"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/categories?post=2984"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/tags?post=2984"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}