DEV Community

Discussion on: How can I make a visual UI in the browser for a Node application?

Collapse
 
michaelcurrin profile image
Michael Currin • Edited

In a Node app that is accessible in the browser, typically you have index.html which has:

<head>
  <script src="main.js"></script>
</head>

<body>
  <div id="app"></div>
</body>
Enter fullscreen mode Exit fullscreen mode

And you would use Node to install and bundle dependencies and convert TypeScript etc. to plain JS and output as a single main.js or index.js file.

For a simple project, the main JS file could be the file as you wrote it, without transformation

Collapse
 
baenencalin profile image
Calin Baenen

I still don't understand. If I run live-server, will that allow Node to run in index.html?

Collapse
 
michaelcurrin profile image
Michael Currin

See comment

Collapse
 
ivan_jrmc profile image
Ivan Jeremic

I recommend first learning node

Collapse
 
michaelcurrin profile image
Michael Currin

See for example the React tutorial for adding React to an HTML page.

reactjs.org/docs/add-react-to-a-we...

You don't even need any JS files if start really simple but it will be easier to manage as multiple files.