# Backend and frontend communication

**URL:** <https://discourse.nodered.org/t/backend-and-frontend-communication/23944>\
**Category:** Core Development\
**Created:** [31 March 2020 07:23 UTC](https://discourse.nodered.org/t/backend-and-frontend-communication/23944 "2020-03-31T07:23:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmdares](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cmdares/32/29549_2.png) [@cmdares](https://discourse.nodered.org/u/cmdares)\
**Post date:** [31 March 2020 07:23 UTC](https://discourse.nodered.org/t/backend-and-frontend-communication/23944/1 "2020-03-31T07:23:18Z")

</div>

lower-case.js:  
module.exports = function(RED) {  
var myObject = {"x":1,"y":2};/_myobject_/  
function LowerCaseNode(config) {  
RED.nodes.createNode(this,config);  
var node = this; t  
his.on('input', function(msg) {  
/_??how to access "flow" object ?? flow.get("xxx")??_/  
msg.payload = msg.payload.toLowerCase();  
node.send(msg); }); }  
RED.nodes.registerType("lower-case",LowerCaseNode); }

lower-case.html:  
\</script type="text/javascript"\>  
RED.nodes.registerType('lower-case',{ category: 'function', color: '#a6bbcf', defaults: { name: {value:""} },  
inputs:1,  
outputs:1,  
icon: "file.png",  
label: function() { return this.name||"lower-case"; },  
oneditprepare: function () {  
alert(myObject['x']);/_?? how to get "js" object ??_/  
} });  
script\>

thanks!  
regard

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [31 March 2020 08:14 UTC](https://discourse.nodered.org/t/backend-and-frontend-communication/23944/2 "2020-03-31T08:14:40Z")

</div>

Hi @cmdares

please try to format your code using the `</>` button in the formatting toolbar. That will make it much easier to read. It took me a while to spot your questions hidden in the code.

> [@cmdares](#):
>
> / _??how to access "flow" object ?? flow.get("xxx")??_ /

The documentation for using Context in your node is here: [Node context : Node-RED](https://nodered.org/docs/creating-nodes/context)

> [@cmdares](#):
>
> alert(myObject['x']);/ _?? how to get "js" object ??_ /

There is no built-in way for the editor side to directly access runtime variables. If you really need to do this, you would have to create a new admin HTTP endpoint in your `.js` file that you can call in your `.html` file to access the information.

There is a high-level description of how to do that here: [javascript - Send data on configuration - Stack Overflow](https://stackoverflow.com/questions/41567175/send-data-on-configuration/41567832#41567832)

---

<div class="post-metadata">

**Author:** ![cmdares](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cmdares/32/29549_2.png) [@cmdares](https://discourse.nodered.org/u/cmdares)\
**Post date:** [10 May 2020 03:32 UTC](https://discourse.nodered.org/t/backend-and-frontend-communication/23944/3 "2020-05-10T03:32:38Z")

</div>

thanks! I'll try the way.

---

<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:** [9 July 2020 03:32 UTC](https://discourse.nodered.org/t/backend-and-frontend-communication/23944/4 "2020-07-09T03:32:42Z")

</div>

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