Well, the answer of Augusto Vasques did not solve my problem, which would be to see the variables and functions of the modules of the client-side of Node.js through Inspect Chrome (browser I use).
After a lot of research, I figured out how to see and manipulate variables and functions. In the modules or in the main code (not in the index.js or app.js file of Node.js, commonly called, but in the modules that will be used by the browser, client-side), instead of declaring the variables and functions commonly so:
var <variável> = 100;
let <variável2> = "Frase";
const <variável3> = 3.1415; // Pi
do:
globalThis.<variável> = "Conteúdo da variável".length; // === 20
globalThis.<nome_da_função> = function ( params ) { <bloco de código> };
OR in place of "globalThis" one can also put "window", which refer to the same object, which is the browser.
NOTE: BUT BE AWARE THAT IT ONLY SERVES TO DEVELOP THE CODE AND TEST IT THROUGH THE BROWSER!!! It shouldn’t be final product because your code is vulnerable! Soon you should turn back to:
var/ let/ const <variável> = <Conteúdo>;
function <nome_da_função> ( params ) { <bloco de código> }
I got to the Chrome Inspect part, but I couldn’t find the server listed, and I couldn’t add it through the Configure button. Is there anything I can do to get around this problem? I’ve already activated Developer Tools experiments from Chrome, and I’ve installed Chrome-remote-interface.
– Kelvin de Miranda Barros
I don’t know how these settings affect the debugger and its connectivity, I advise you to use the default settings. As for the url generated by
node --inspect
they are random the same url generated for me will not be useful for you so you have to use the url generated in your console immediately the callnode --inspect
.– Augusto Vasques