---
title: "Discussion on \"How I Queried Hashnode's GraphQL API to display my hashnode blog posts on my Nuxt Website\" | Hashnode"
description: "Discussion on \"How I Queried Hashnode's GraphQL API to display my hashnode blog posts on my Nuxt Website\". Hi there dev,\nI am Idris (if you don't already know), I recently started building my portfolio website at  idrislawal.com  with Nuxt JS and realized I needed to have my blog posts from hashnode also on my website, so I thought to myself, how do I mak..."
url: "https://hashnode.com/posts/how-i-queried-hashnodes-graphql-api-to-display-my-hashnode-blog-posts-on-my-nuxt-website/5ddad5301d03daa468a991c0"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [How I Queried Hashnode's GraphQL API to display my hashnode blog posts on my Nuxt Website](https://idrislawal.com/how-i-queried-hashnodes-graphql-api-to-display-my-hashnode-blog-posts-on-my-nuxt-website?utm_source=hashnode&utm_medium=feed)

Hi there dev, I am Idris (if you don't already know), I recently started building my portfolio website at idrislawal.com with Nuxt JS and realized I needed to have my blog posts from hashnode also on my website, so I thought to myself, how do I mak...

Nov 24, 2019 · 6 min read · idrislawal.com  
Updated Sep 14, 2020  
Read the article

-   [#jamstack](https://hashnode.com/tag/jamstack)
-   [#hashnode](https://hashnode.com/tag/hashnode)
-   [#apis](https://hashnode.com/tag/apis)

## Written by

[Idris Lawal](https://hashnode.com/@idris-lawal)

@idris-lawal

  
[View profile](https://hashnode.com/@idris-lawal)

Software Engineer

Software Engineer from Lagos, Nigeria

## Responses 5

Markdown supported · ⌘↵ to post

[spiritbro](https://hashnode.com/@spiritbroapp)

[Nov 27, 2020](https://hashnode.com/posts/how-i-queried-hashnodes-graphql-api-to-display-my-hashnode-blog-posts-on-my-nuxt-website/5ddad5301d03daa468a991c0/comment/5fc069ce7f8d06480aa0ebbe)

hello do you know how to post publication story using graphql?

i have tried like this but no luck:

```
mutation{createPublicationStory(publicationId:"helloguys",input:{title:"trying da graphql ",contentMarkdown:"wish me ",tags:[]}){code,message,success}}
```

[Peter Thaleikis](https://hashnode.com/@spekulatius)

[Sep 14, 2020](https://hashnode.com/posts/how-i-queried-hashnodes-graphql-api-to-display-my-hashnode-blog-posts-on-my-nuxt-website/5ddad5301d03daa468a991c0/comment/5f5f19cb13599a5f2e34045d)

Interesting!

[Tina Holly](https://hashnode.com/@tinaciousdesign)

[Aug 4, 2020](https://hashnode.com/posts/how-i-queried-hashnodes-graphql-api-to-display-my-hashnode-blog-posts-on-my-nuxt-website/5ddad5301d03daa468a991c0/comment/5f28f93f09567e0dc187f16c)

Hello 👋 Interesting post!

The **user -> publications -> post** query appears to return only 6 entries and not support pagination. Have you found an undocumented workaround or an alternative query?

I also noticed your post detail page no longer works on your Nuxt site.

I also just wanted to note a security concern you may want to address—your API key is exposed in the Authorization header. You may not be aware, but this token allows both read and write privileges. A bad actor could create posts on your blog without you knowing since your key is exposed.

From the developer dashboard:

> Personal Access Token is like a private key to your Hashnode account \[...\] **Never disclose your access tokens and always keep them private.**

If you use Nuxt as a static site generator, you can work around this by implementing `asyncData()` with a `process.server` check so that you only make the request when you're generating your website server-side, that way your token is not exposed:

```
export default Vue.extend({
  components: {
    // ...
  },

  asyncData () {
    if (process.server) {
      return getPosts()
        .then((data) => {
          return { 
            posts: data.posts 
          }
        })
    }

    return { 
      posts: [] 
    };
  },

  data() {
    return {
      posts: []
    };
  },

})
```

[Idris Lawal](https://hashnode.com/@idris-lawal)

[Sep 14, 2020](https://hashnode.com/posts/how-i-queried-hashnodes-graphql-api-to-display-my-hashnode-blog-posts-on-my-nuxt-website/5ddad5301d03daa468a991c0/comment/5f28f93f09567e0dc187f16c#reply-5f5fd4da7c5fa67dd5903091)

Wow, how did I miss this? Thanks a lot for your valuable feedback. You notes here are absolutely correct. I started making some changes to my portfolio page and broke a couple of things, but I haven't had the time to fix it up.

Thank you!

[Sandeep Panda](https://hashnode.com/@sandeep)

[Nov 25, 2019](https://hashnode.com/posts/how-i-queried-hashnodes-graphql-api-to-display-my-hashnode-blog-posts-on-my-nuxt-website/5ddad5301d03daa468a991c0/comment/5ddb83116c0aefa8683def19)

Nice stuff. Thanks for sharing. Do note that fetching personal blog posts of a user doesn't require an auth key. It's a public endpoint.

[Idris Lawal](https://hashnode.com/@idris-lawal)

[Nov 25, 2019](https://hashnode.com/posts/how-i-queried-hashnodes-graphql-api-to-display-my-hashnode-blog-posts-on-my-nuxt-website/5ddad5301d03daa468a991c0/comment/5ddb83116c0aefa8683def19#reply-5ddb8e171d03daa468a994a3)

I actually thought, it did. Its probably best I leave the auth key though, so I wouldn't have to worry about whether the endpoint is public or private. Thank you!

[Syed Fazle Rahman](https://hashnode.com/@fazlerocks)

[Nov 25, 2019](https://hashnode.com/posts/how-i-queried-hashnodes-graphql-api-to-display-my-hashnode-blog-posts-on-my-nuxt-website/5ddad5301d03daa468a991c0/comment/5ddb6ceb1d03daa468a992fe)

This is amazing! Thanks [Idris Lawal](https://hashnode.com/@Titanium) for sharing this. :)
