created the node server in a function to be exported as a module