# Http endpoint guidelines

**URL:** https://discourse.nodered.org/t/http-endpoint-guidelines/2309
**Category:** Developing Nodes
**Created:** [15 August 2018 15:35 UTC](https://discourse.nodered.org/t/http-endpoint-guidelines/2309 "2018-08-15T15:35:41Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)
#### Post date: [15 August 2018 15:35 UTC](https://discourse.nodered.org/t/http-endpoint-guidelines/2309/1 "2018-08-15T15:35:41Z")

</div>

Hi folks,

The config screen of my node-red-contrib-blockly node needs to load a series of Javascript library files from the server. This is implemented by using a http endpoint:

```
RED.httpAdmin.get('/blocky/js/*', function(req, res){
   ...
}

```

I have always thought this was the correct way of working, since you can find following explanation in the Node-RED [cookbook](https://github.com/node-red/cookbook.nodered.org/wiki/Create-an-admin-configuration-API-endpoint):

> Sometimes a custom node needs to be able to look up additional data at configuration time (e.g. when editing the configuration of a node instance in the admin interface).  
> The approved way to do this is for the node to register an extra http endpoint to use as an API.

However today an [issue](https://github.com/bartbutenaers/node-red-contrib-blockly/issues/12) is raised for my blockly node:

> Node doesn't show the blockly editor control when custom httpAdminRoot in use.

I have never used the httpAdminRoot setting, but seems that it allows you to disable all admin endpoints (both API endpoints and the editor UI). So I assume that my endpoint is disabled =\> no .js files are loaded =\> the blockly editor is not displayed...

Does anybody have a clue how I can solve this?

Thanks !!!  
Bart

---

<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: [15 August 2018 15:56 UTC](https://discourse.nodered.org/t/http-endpoint-guidelines/2309/2 "2018-08-15T15:56:08Z")

</div>

If you disable `httpAdminRoot` then nothing will load in the editor at all because the admin api has been disabled.

The issue is how you are loading it from the browser side: [https://github.com/bartbutenaers/node-red-contrib-blockly/blob/master/blockly.html#L21-L33](https://github.com/bartbutenaers/node-red-contrib-blockly/blob/master/blockly.html#L21-L33)

Long story short, remove the `/` from the front of all those urls so the browser loads them relative to where the editor was loaded from rather than as an absolute path from the root of the domain.

On the wiki page you link to, you'll note this is spelt out in the very last bullet point on the page.

Nick

---

<div class="post-metadata">

### Author: ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)
#### Post date: [15 August 2018 16:06 UTC](https://discourse.nodered.org/t/http-endpoint-guidelines/2309/3 "2018-08-15T16:06:31Z")

</div>

Thanks Nick, sounds logical. Will give that a try!

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [15 August 2018 16:27 UTC](https://discourse.nodered.org/t/http-endpoint-guidelines/2309/4 "2018-08-15T16:27:39Z")

</div>

In uibuilder, I make sure I use RED.settings.httpNodeRoot in the URL so this doesn't happen. Something like the following example:

```javascript
$('#uibuilderurl').empty().append('<a href="' + RED.settings.httpNodeRoot + $(this).val() + '">' + RED.settings.httpNodeRoot + $(this).val() + '</a>')

```

---

<div class="post-metadata">

### Author: ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)
#### Post date: [15 August 2018 19:31 UTC](https://discourse.nodered.org/t/http-endpoint-guidelines/2309/5 "2018-08-15T19:31:29Z")

</div>

@TotallyInformation: Will keep it in mind for my next node. Wasn't aware about the existence of something like httpAdminRoot ...
