Accessible file in both server and client

Is there anyway that I can access a js file in both the nodejs server and client?

Hi! For client, you can use:

fetch(url)
.then(e => e.text())
.then(e => console.log(e))

For server, you can use fs

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.