Friday 11 March 2016

What is the correct way to use different folder?

I'm trying to develop a simple web app and I can't find a way to use different JS files stored in a different folder from the root one, I'll try to explain better.. this is my file structure:myapp ├── clientSide │ ├── downloads.html │ ├── getDown.js │ ├── index.html │ └── uptime.js ├── index.html.save └── serverSide └── myapi.js The server is running myapi.js and this is chunk of the code:app.use("/clientSide", express.static(__dirname + '/clientSide')); console.log(__dirname); exec("sudo /sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{print $1}'", function(error, stdout, stderr){ ip = stdout; exports.ipAdd = ip; console.log(ip); }); now..the problem is that from index.htm I can't import and use the JS files inside the clientSide directory using a simpleandcan anyone please edit my piece of code in order to understand? Thanks!

Submitted March 11, 2016 at 04:43PM by Fabbio1984

No comments:

Post a Comment