I am trying to write a node module to clear my code and split it into different files.
Consider the code below:
module.exports = { Hello : function(request, reply) { return reply("Hello " + World()); }, World : function() { return "World"; } }
If I import the above module and use the Hello function as a handler for a specific route, I get an internal HTTP 500 server error.
I narrowed down the problem to calling World () if I changed the Hello function to
Hello : function(request, reply) { return reply("Hello World"); }
Then it works fine, so it seems to work when another function is called from the export object
Does anyone know why this is happening and how to solve it?
source share