Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

mongoose and express get requests

app.get('/api/all', (req,res) =>{
     Model.find({})
       .then(model=> {
         res.json(model)
     }).catch(error=>{
         res.json(error)
        }
     })
})
 
PREVIOUS NEXT
Tagged: #mongoose #express #requests
ADD COMMENT
Topic
Name
8+7 =