# Code review for newish plugin

**URL:** <https://discourse.nodered.org/t/code-review-for-newish-plugin/19990>\
**Category:** Developing Nodes\
**Created:** [7 January 2020 00:29 UTC](https://discourse.nodered.org/t/code-review-for-newish-plugin/19990 "2020-01-07T00:29:17Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![iOnline247](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ionline247/32/15634_2.png) [@iOnline247](https://discourse.nodered.org/u/iOnline247)\
**Post date:** [7 January 2020 00:29 UTC](https://discourse.nodered.org/t/code-review-for-newish-plugin/19990/1 "2020-01-07T00:29:17Z")

</div>

I'm close to publishing a new plugin, but would like a code review for common mistakes, since this is my first one. Please take a look and provide feedback.

[https://github.com/iOnline247/node-red-contrib-aws-any](https://github.com/iOnline247/node-red-contrib-aws-any)

Thanks!

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [7 January 2020 07:06 UTC](https://discourse.nodered.org/t/code-review-for-newish-plugin/19990/2 "2020-01-07T07:06:14Z")

</div>

My first comment is that the readme should say what the node is for, and how to install and use it. It is impossible to do a code review without knowing what it is supposed to do and how to use it.

---

<div class="post-metadata">

**Author:** ![iOnline247](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ionline247/32/15634_2.png) [@iOnline247](https://discourse.nodered.org/u/iOnline247)\
**Post date:** [8 January 2020 05:46 UTC](https://discourse.nodered.org/t/code-review-for-newish-plugin/19990/3 "2020-01-08T05:46:08Z")

</div>

My apologies @Colin. Your feedback was the best I could have gotten, as I completely forgot the docs! 😃

If you have some time, feel free to review the plugin now that I've added a lot more to the Readme.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [8 January 2020 07:56 UTC](https://discourse.nodered.org/t/code-review-for-newish-plugin/19990/4 "2020-01-08T07:56:46Z")

</div>

I am sorry but the readme still doesn't give me much idea about what the node does our how to use it. Is the use of the letters aws in the name significant?

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [8 January 2020 08:36 UTC](https://discourse.nodered.org/t/code-review-for-newish-plugin/19990/5 "2020-01-08T08:36:38Z")

</div>

I assume aws means Amazon Web Services..... but any is a bit general - Does it really handle them all ? as amazon do have a lot of api for different services. They even have a gateway to help users access all their other ones.. eg [https://aws.amazon.com/api-gateway/](https://aws.amazon.com/api-gateway/) Is this a gateway node ?  
Still no idea what this node does though.

---

<div class="post-metadata">

**Author:** ![iOnline247](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ionline247/32/15634_2.png) [@iOnline247](https://discourse.nodered.org/u/iOnline247)\
**Post date:** [8 January 2020 14:12 UTC](https://discourse.nodered.org/t/code-review-for-newish-plugin/19990/6 "2020-01-08T14:12:45Z")

</div>

You should be able to use any API listed here:  
[https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/APIGateway.html](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/APIGateway.html)

---

<div class="post-metadata">

**Author:** ![iOnline247](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ionline247/32/15634_2.png) [@iOnline247](https://discourse.nodered.org/u/iOnline247)\
**Post date:** [11 January 2020 00:49 UTC](https://discourse.nodered.org/t/code-review-for-newish-plugin/19990/7 "2020-01-11T00:49:04Z")

</div>

If you have a second, I've added more verbiage, some screenshots, and example flows. The questions I have are around these points:

- Node-RED anti-patterns
- Should I have 2 outputs: 1 for success and 1 for errors or let the catch node handle errors as the examples are doing?
- Is Node-RED signaled properly when `send` is [invoked within the script](https://github.com/iOnline247/node-red-contrib-aws-any/blob/master/src/nodes/aws-sdk-any/aws-sdk-any.js#L73)?
- Is the `aws-sdk-any` node backwards compatible with previous versions prior to v1?

@dceejay I'm not sure what a Gateway node is, can you point me to some docs, so I can read up on them?
