Skip to content

Holly845/devconnector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

I created this repository to help debug an issue I reported on StackOverflow. The issue I'm having is that the .then() method is not being executed when I call the mongoose findOne() method, which seems not to be returning a es2015 Promise. More details of the issue can be found on the StackOverflow Question.

Requirments

  • node v8.11.1
  • MongoDB shell version v4.0.1
  • MongoDB server version: 4.0.1

Installation

To reproduce this issue you need to first install and setup MongoDB and then Node.js app of this repository.

Install MongoDB

  1. Install the MOngoDB community server from their download centre.
  2. Launch the MongoDB server with the mongod command in your terminal. (You can stop it by pressing CTRL + C)
  3. IN a new terminal window connect to the MongoDB via it's mongo shell command.
  4. Create a database with following commands... use devconnector db.testData.insert( { Description : "Initial document used to create database" } )

Install Nodejs app from this Repository

Enter the command below into your terminal to download the repository from github, install and launch it.

git clone https://github.com/bradtraversy/devconnector.git
cd devconnector
npm install
npm run debug

You should now be able to reproduce the issue.

Reproducing the issue

Open your browser at http://localhost:5000/ and in it's console enter...

fetch("http://localhost:5000/api/users/register", {
  method: "POST",
  body: JSON.stringify({
    name: "holly",
    email: "holly@mail.com",
    password: "holly123"
  }),
  headers: {
    "Content-type": "application/json; charset=UTF-8"
  }
})
  .then(response => response.json())
  .then(json => console.log(json));

If you use the nodeJS debugger you will see that the code does not execute line 29 of routes/api/users.js.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published