I am facing a problem, where Item.create(...) inserts new entry into a document, but hangs afterwards.
Here is my code:
app.get('/api/users/all',(req,res) => {
User.create({ //inserts new entry
username : "domen",
name : "domenk",
location : "usa",
rating : 0,
bio : "Student",
skills : 'c#',
projects_completed: 0,
views : 0
}), (err,user) => { //from here down nothing is executed
if(err)
console.log(err);
User.find((err,users) => {
if(err)
res.send(err);
res.json(users);
})
}
});
I am testing this with /GET method, just for getting new entries to the database. But the page hangs, nothing is returned. Where is the problem?
via user115
No comments:
Post a Comment