I was trying to display a text that was read from a file on my client-side HTML. But when I use require 'fs' it doesn't work because of security concerns. Is there any way to read a file stored on a server using fs then display it on the client-side. A rough sketch of what I'm trying to do is attached below but it doesn't work because I get error require is not defined
. Any help is appreciated thanks in advance.
const fs = require('fs')
const data = fs.readFileSync('filePath', 'utf-8')
<p id="insertHere" style="color: white;"></p>
<script> document.getElementById("insertHere").innerHTML = data;</script>