# ELI5 NPM and JS

**URL:** <https://discourse.nodered.org/t/eli5-npm-and-js/26887>\
**Category:** General\
**Created:** [18 May 2020 23:11 UTC](https://discourse.nodered.org/t/eli5-npm-and-js/26887 "2020-05-18T23:11:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![VinistoisR](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vinistoisr/32/5778_2.png) [@VinistoisR](https://discourse.nodered.org/u/VinistoisR)\
**Post date:** [18 May 2020 23:11 UTC](https://discourse.nodered.org/t/eli5-npm-and-js/26887/1 "2020-05-18T23:11:03Z")

</div>

I'm a beginner with npm and Js. Can someone ELI5 a bit how it all works?

If I find an npm module that is not written for node-red, can I do anything with it, in the context of node-red?

For example, I've been working with the Roblox API and came across this: [https://www.npmjs.com/package/noblox.js](https://www.npmjs.com/package/noblox.js)

Can I work with this in node-red somehow?

Getting even deeper into details, using the API I can get back a URL of my user's avatar. I'd like node-red to then download the avatar and store it / display it.

Thanks for any hints!

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [18 May 2020 23:14 UTC](https://discourse.nodered.org/t/eli5-npm-and-js/26887/2 "2020-05-18T23:14:52Z")

</div>

You can build a node-red node (see the docs)

You can `require` a module in settings.js and use it like regular node in a function node. (Again see the docs)

You can use node-red-contrib-npm node to do ad-hoc require and use it in situ. (Search flows library)

However if it's just a rest API, just use the built in nodes.

There isn't much you can't do.

I've actually written protocol drivers for an old PLC in node-red using standard nodes.

---

<div class="post-metadata">

**Author:** ![VinistoisR](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vinistoisr/32/5778_2.png) [@VinistoisR](https://discourse.nodered.org/u/VinistoisR)\
**Post date:** [19 May 2020 00:10 UTC](https://discourse.nodered.org/t/eli5-npm-and-js/26887/3 "2020-05-19T00:10:01Z")

</div>

Thanks!! So in theory I could build "Roblox nodes" for node-red using this module?

Also, Yes, it's just a rest API. I found it pretty easy, using Postwoman, for example to make queries and get the responses I expected. I guess I'm missing the point, why would someone create this npm module if working with the API directly is straightforward? What are the benefits? I guess if I knew what I was talking about, these questions would be obvious haha.

What I need to do is save the responses into variables so that I can build a kind of live dashboard.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [19 May 2020 06:36 UTC](https://discourse.nodered.org/t/eli5-npm-and-js/26887/4 "2020-05-19T06:36:31Z")

</div>

> [@VinistoisR](#):
>
> why would someone create this npm module if working with the API directly is straightforward?

Beats me. But seriously, it will likely simplify the requests to simple function calls. But if you are comfortable preparing URLs and setting headers etc, there is no real need.

> [@VinistoisR](#):
>
> What I need to do is save the responses into variables so that I can build a kind of live dashboard.

You would store them in flow or global context of you need later retrieval.

If you're just beginning node red (or you aren't yet up to full steam ahead) this playlist is an easy watch and packed with top tips. [https://www.youtube.com/playlist?list=PLyNBB9VCLmo1hyO-4fIZ08gqFcXBkHy-6](https://www.youtube.com/playlist?list=PLyNBB9VCLmo1hyO-4fIZ08gqFcXBkHy-6)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [18 July 2020 06:36 UTC](https://discourse.nodered.org/t/eli5-npm-and-js/26887/5 "2020-07-18T06:36:39Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
