On page 60 in the textbook Jeff introduces the Router object that express provided to give a cleaner solution in regard to using the module.export wrapper. Following this process step by step will provide a problem for the user when they try to run the program
Applications/MAMP/htdocs/socialNetProj/controllers/static.js:14
var router = ('express').Router()
^
TypeError: Object express has no method 'Router'
at Object. (/Applications/MAMP/htdocs/socialNetProj/controllers/static.js:14:27)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/Applications/MAMP/htdocs/socialNetProj/server.js:9:9)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
One way I managed to resolve this is by researching on the router object in the expressJS website
//store the express router object into a variable called router.
var router = express.Router()
Once i refactored my code with this I was able to get the nodemon running again I am not sure on why or how come this issue occured but my recommendation is to refer tot he express.js API is this occurs again for anyone else.
On page 60 in the textbook Jeff introduces the Router object that express provided to give a cleaner solution in regard to using the module.export wrapper. Following this process step by step will provide a problem for the user when they try to run the program
Applications/MAMP/htdocs/socialNetProj/controllers/static.js:14 var router = ('express').Router() ^ TypeError: Object express has no method 'Router' at Object. (/Applications/MAMP/htdocs/socialNetProj/controllers/static.js:14:27)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/Applications/MAMP/htdocs/socialNetProj/server.js:9:9)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
One way I managed to resolve this is by researching on the router object in the expressJS website
http://expressjs.com/guide/using-middleware.html#middleware.router
//store the express router object into a variable called router. var router = express.Router()
Once i refactored my code with this I was able to get the nodemon running again I am not sure on why or how come this issue occured but my recommendation is to refer tot he express.js API is this occurs again for anyone else.