Friday 27 March 2020

encountering issue when attempting to run 2 node servers within a single node project?

I've created a new node project in VS Code.I created a single node server file (server.js) in the project and was able to run it by configuring a new child property in the package.json scripts config section.I created a second node server file (authServer.js) in the project and configured an additional child property in the package.json scripts config section.The first node server runs successfully when I npm run its package.json script.The second node server fails when I npm run its package.json script with error "Cannot find module .\index.js."An index.js file was not included in the new project by default. I'm following a demo vid on YouTube which also does not have an index.js file at the root but the YouTube vid example loads up the second server without issueSo it looks like an index.js file or some special config is required when 2 node servers are loaded from the same project.Any idea what I might be missing here or how to fix? Like I mentioned, the example YouTube vid ran the second server from the project without issue without having an index.js file in the project so I'm not sure why my local project is throwing an error?

Submitted March 27, 2020 at 11:52PM by random503

No comments:

Post a Comment