Wednesday, May 16, 2018

how to suck files into other files in an Express app

At the last line of mySecondaryFile.js you could have something like...

module.exports = { foo, bar, baz, qux };



module.exports = foo;


...and then towards towards the top of app.js you could have:

const secondaryStuff = require('./somewhere/mySecondaryFile');


You could then use the foo like so...

var whatever =;


...assuming that foo is a function that takes a number and then returns something and also assuming that foo was one of many things enclosed in curly braces as shown in the first line of code above. If foo alone is the assignment value in the last line of code at mySecondaryFile.js as shown in the second line of code above then you need to do something like this:

var whatever = secondaryStuff(13);


Why can't we have an ASP.NET Web API application for the server? It's all so ghetto. It's like I'm in a bad horror movie expecting Lance Henriksen to show up.

No comments:

Post a Comment