Reputation: 127
I just started with nodejs
and since I can't reference the app.js
to the html file since I'm actually starting that js file
with the nodejs. Is there a way to achieve this?
Upvotes: 0
Views: 1110
Reputation:
Check this tutorial
It's a detailed and great explanation for what you need.
Upvotes: 1
Reputation: 164
It doesn't work like that. I think you are trying to use the app.js file of a node app as if it was a simple script reference in the html with the tags.
NodeJS runs in the server and the HTML file runs in the client. The server script you are running can provide data to the client, client-server must be "connected" with an API.
If you are using vue or react for the Front-End, check Axios as a library for fetching data via API.
Upvotes: 3