DEV Community

Discussion on: Create a backend in Javascript (part 2): NodeJS Module System

Collapse
 
beauspot profile image
Iyere Handsome(Beau) Omogbeme

There is a bug on your code in the module app.js. You are exporting the greeting function but then when you want to import it you don't use the greeting function in another module rather you say require('app.js'), not 'greeting'. if you run the code It would throw an error stating that the module greeting cannot be found. greeting() is not a module rather it is a function that is exported from a module to another. I would upload Images for you to see what I am saying.

Collapse
 
beauspot profile image
Iyere Handsome(Beau) Omogbeme

This code would return an error stating that the module cannot be found