# Using npm module graphql-request in Fuse

**URL:** <https://forums.fusetools.com/t/using-npm-module-graphql-request-in-fuse/4249>\
**Category:** How-to Discussions\
**Created:** [August 3, 2017, 12:38pm UTC](https://forums.fusetools.com/t/using-npm-module-graphql-request-in-fuse/4249 "2017-08-03T12:38:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nikolas\_Burk](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/nikolas_burk/32/475_2.png) [@Nikolas\_Burk](https://forums.fusetools.com/u/Nikolas_Burk)\
**Post date:** [August 3, 2017, 12:38pm UTC](https://forums.fusetools.com/t/using-npm-module-graphql-request-in-fuse/4249/1 "2017-08-03T12:38:00Z")

</div>

I’m trying to get the npm module [graphql-request](https://github.com/graphcool/graphql-request) to work with Fuse. I have an empty app where I do the following:

1. Run `npm init` to create a `package.json`
2. Run `npm install graphql-request --save` to install the package
3. Run `nfuse` to make it available to the Fuse environment

Then, in a JS module inside my app I’m trying to use it with the following code:

```auto
var request = ("graphql-request"); // also tried ("graphql-request").request

var endpoint = "https://api.graph.cool/simple/v1/cj5s6t2ts2oo70122p1ht5ye5";
var query = "{ allMessages { text } }";

request(endpoint, query).then(function(data) {
  console.log(data);
});

```

But I’ll only get an error saying: `JS stack trace: TypeError: request is not a function`

Any ideas how I can make this work?

---

<div class="post-metadata">

**Author:** ![Sebastian\_Reinhard](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/sebastian_reinhard/32/513_2.png) [@Sebastian\_Reinhard](https://forums.fusetools.com/u/Sebastian_Reinhard)\
**Post date:** [August 16, 2017, 10:08am UTC](https://forums.fusetools.com/t/using-npm-module-graphql-request-in-fuse/4249/2 "2017-08-16T10:08:39Z")

</div>

Hi! It looks to me like you’re missing a `require` in the first line 🙂

Also, looking at the graphql-request library, it seems like you had the right idea in your comment about `require("graphql-request").request`

---

<div class="post-metadata">

**Author:** ![Nikolas\_Burk](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/nikolas_burk/32/475_2.png) [@Nikolas\_Burk](https://forums.fusetools.com/u/Nikolas_Burk)\
**Post date:** [August 16, 2017, 10:12am UTC](https://forums.fusetools.com/t/using-npm-module-graphql-request-in-fuse/4249/3 "2017-08-16T10:12:47Z")

</div>

Ah - _facepalm_! Not sure if this was the actual issue though or just made it into this post as a typo… I had spent quite some time on the problem and did try a few different approaches… I’ll check if I can get it to work now, thanks for the response anyways!

---

<div class="post-metadata">

**Author:** ![mail.krshna](https://avatars.discourse-cdn.com/v4/letter/m/d26b3c/32.png) [@mail.krshna](https://forums.fusetools.com/u/mail.krshna)\
**Post date:** [November 21, 2017, 11:50am UTC](https://forums.fusetools.com/t/using-npm-module-graphql-request-in-fuse/4249/4 "2017-11-21T11:50:29Z")

</div>

Hello Nikolas,

Did you get around to making this work? I’m in the exact same situation and no matter how I try to add it, I end up with the following error:

`Error message: Uncaught require(): module not found: graphql-request`

Thanks

---

<div class="post-metadata">

**Author:** ![bai](https://avatars.discourse-cdn.com/v4/letter/b/76d3ee/32.png) [@bai](https://forums.fusetools.com/u/bai)\
**Post date:** [December 26, 2017, 10:42am UTC](https://forums.fusetools.com/t/using-npm-module-graphql-request-in-fuse/4249/5 "2017-12-26T10:42:57Z")

</div>

you can connect through it [https://github.com/f/graphql.js/](https://github.com/f/graphql.js/) (does not require node js) if you want to subscribe then look at this example [https://github.com/f/graphql.js-demo](https://github.com/f/graphql.js-demo) and it all works through graphcool [https://www.graph.cool/](https://www.graph.cool/) sorry my eng =)

 ![file](https://s3.us-east-2.amazonaws.com/fuse-legacy-forum-assets/oEIvbodS3vqq-image-1514285438283.49.20.png)  
--------------------------------------------------------------------------------------------------- ![file](https://s3.us-east-2.amazonaws.com/fuse-legacy-forum-assets/1eZXUF27zJNY-image-1514285416922.48.59.png)
