# How do I handle the license for a node for which I use code from the switch node?

**URL:** <https://discourse.nodered.org/t/how-do-i-handle-the-license-for-a-node-for-which-i-use-code-from-the-switch-node/77292>\
**Category:** Developing Nodes\
**Created:** [5 April 2023 22:45 UTC](https://discourse.nodered.org/t/how-do-i-handle-the-license-for-a-node-for-which-i-use-code-from-the-switch-node/77292 "2023-04-05T22:45:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ericbenjaminjr](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ericbenjaminjr/32/46795_2.png) [@ericbenjaminjr](https://discourse.nodered.org/u/ericbenjaminjr)\
**Post date:** [5 April 2023 22:45 UTC](https://discourse.nodered.org/t/how-do-i-handle-the-license-for-a-node-for-which-i-use-code-from-the-switch-node/77292/1 "2023-04-05T22:45:26Z")

</div>

Hi all, I've created a node for which I used the rule engine from the switch node. I've been doing some research on the Apache 2.0 license, but I'm still not sure how I should handle this. I also would like to use the same license. But do I include the original node-red license file in the repo? And what about the file headers? Do I include both the one in the switch node files and mine as well? It's all very unclear to me.

Thanks!

---

<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:** [5 April 2023 23:17 UTC](https://discourse.nodered.org/t/how-do-i-handle-the-license-for-a-node-for-which-i-use-code-from-the-switch-node/77292/2 "2023-04-05T23:17:12Z")

</div>

Hi. Just set the licence type in your package.json & add a LICENSE file along side the package file. Easy peasy 🙂

---

<div class="post-metadata">

**Author:** ![ericbenjaminjr](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ericbenjaminjr/32/46795_2.png) [@ericbenjaminjr](https://discourse.nodered.org/u/ericbenjaminjr)\
**Post date:** [6 April 2023 00:00 UTC](https://discourse.nodered.org/t/how-do-i-handle-the-license-for-a-node-for-which-i-use-code-from-the-switch-node/77292/3 "2023-04-06T00:00:39Z")

</div>

Yes, that's the easy peasy way if all of the code was mine. But like I said, I'm using the rule engine from the switch node which is not only already licensed under Apache 2.0, but also **Copyright JS Foundation**. Maybe I should've made that part clearer. As far as I've understood, I have to include the original license with the copyright statement? So that would mean two license files?

---

<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:** [6 April 2023 06:38 UTC](https://discourse.nodered.org/t/how-do-i-handle-the-license-for-a-node-for-which-i-use-code-from-the-switch-node/77292/4 "2023-04-06T06:38:08Z")

</div>

I am not a lawyer but since you are reusing the same Apache license, from my understanding of section 4 (Redistribution) it should be enough to include the js foundation copyright header something like...

```auto
/* A large portion of the code in this file
is based on original works from the
node-red switch node. Below is a copy of
the embedded copyright notice.
*/
/* JS foundation copyright ... ... ...
.... ... ...
*/

```

---

<div class="post-metadata">

**Author:** ![ericbenjaminjr](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ericbenjaminjr/32/46795_2.png) [@ericbenjaminjr](https://discourse.nodered.org/u/ericbenjaminjr)\
**Post date:** [13 April 2023 12:17 UTC](https://discourse.nodered.org/t/how-do-i-handle-the-license-for-a-node-for-which-i-use-code-from-the-switch-node/77292/5 "2023-04-13T12:17:23Z")

</div>

Thanks, thats an idea.
