Provide HTML using Node.js and templating to an HTML website

I created a main menu (navigation) using Node.js. I used Jade as the template engine under express. The menu is created in pure HTML & CSS.

Node.js is intended to provide the menu via a URL. I want to include this menu into an existing web application and it should be provided by Node.js. I thought about something like the following in my website.html:

<body>
  <!-- begin: include main menu -->
  <script type="text/javascript" src="http://127.0.0.1:3000/menu"></script>
  <!-- end: include main menu -->
  the rest of the application/website
  ...
</body>

I got it to work pass some HTML to my website using the following code in my routing mechanism, but I think this is really dirty done:

res.send("document.write('SOME_HTML_GOES_HERE')");

But I need to pass the views/menu.jade as HTML snippet back to the website.html. I already returned whole HTML sites with:

res.render('index', { title: 'Express & Jade' });

How can I get that the menu is loaded in a non Node.js application delivered by Node using a template mechanism?

You should rather use an iframe to include the node.js menu. You can include the HTML rendered by Express and Jade:

<iframe src="http://127.0.0.1:3000/menu"></iframe>

That being said, I think you should try to serve all your website from port 80. Many users cannot access port 3000.

If you're hosting your website on node.js (port 3000) and, say, Apache (port 80), you should try to deploy a proxy in front of both of them. I used HAProxy to do this. In my case, the proxy runs on port 80, Apache on 8000 and node.js on 3000. I have simple rules to redirect request to either node.js or Apache.