Get a variable from a file to another file in node.js( problem not solve )

12
May 15, 2019, at 11:20 PM

I tried too many time but I couldn't a get solution to my problem. my file structure is like following:

  • static
  • views
  • server.js
  • package.json

In the static folder, there are two file 1.js and 2.js.I want to access a variable from file 2.js from file 1.js .

Error come: require is not defined

READ ALSO
Why is my express code not rendering css and javascipt files?

Why is my express code not rendering css and javascipt files?

I am trying to write a basic express server codeHowever, the HTML file that gets served on a particular route does not render the static files (css, js and image files)

30
Keycloak Policy Enforcing for nodejs REST Api

Keycloak Policy Enforcing for nodejs REST Api

It's the first time asking something here, so excuse if I forget to provide some information or any other mistakesSorry for the text wall

49