# Can I "host" stand-alone nodejs apps inside UIBuilder nodes? If so, should I?

**URL:** https://discourse.nodered.org/t/can-i-host-stand-alone-nodejs-apps-inside-uibuilder-nodes-if-so-should-i/51813
**Category:** General
**Tags:** uibuilder
**Created:** [3 October 2021 23:02 UTC](https://discourse.nodered.org/t/can-i-host-stand-alone-nodejs-apps-inside-uibuilder-nodes-if-so-should-i/51813 "2021-10-03T23:02:07Z")
**Posts on this page:** 1
**Showing post:** 2

<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: [4 October 2021 19:47 UTC](https://discourse.nodered.org/t/can-i-host-stand-alone-nodejs-apps-inside-uibuilder-nodes-if-so-should-i/51813/2 "2021-10-04T19:47:10Z")

</div>

> [@shrickus](#):
>
> 1 to server the ui pages, and 1 for all the `/api/xxxxx` backend ajax calls.

Urm, you mean that you have reinvented Node-RED! 😀

> [@shrickus](#):
>
> but i'm having trouble finding a way to enable all the api.js logic (the `express.use('/api/xxxxx')` endpoints)

Well the simple answer would be to use a standard Node-RED http-in/-out pair to define an `/api/:id` endpoint set.

> [@shrickus](#):
>
> trying to reuse the node-red express server and add my own endpoint urls behind the root url that uibuilder has enabled.

Yes, kind of struggling to see why this would be better/easier than using Node-RED itself?

> [@shrickus](#):
>
> then the ui page `/myapp/index.html` could make its normal ajax calls to `/myapp/api/xxxxx` and run without many modifications

uibuilder is generally geared up to do data over websockets ([socket.io](http://socket.io) strictly speaking) rather than REST API's. Node-RED already does REST API's _really_ well. You could easily set your http-in node to have a URL pattern of `/myapp/api/:id`, uibuilder wouldn't object or get in the way at all as long as you don't create a uibuilder web page with the matching URL. At least I think it wouldn't, I've not tested that scenario.

> [@shrickus](#):
>
> Perhaps this is a chance for me to contribute a new feature back to the UIBuilder code... would anybody else find this useful?

I think that we would firstly need to look at why this might be better than the http-in/-out nodes if I'm being honest. If there is a good reason, happy to consider it.

---

_[View the full topic](https://discourse.nodered.org/t/can-i-host-stand-alone-nodejs-apps-inside-uibuilder-nodes-if-so-should-i/51813)._
