Link to Questions and Setup Guide
run npm install in both frontend and backend folders
cd /frontend && npm start
use the debugger to launch our backend/server.js
file
the react page has a form where users can submit reviews. Right now when we submit a review, nothing happens. When we click Show Reviews, no reviews appear....
look at /backend/server.js
Some essential code is missing.
set the url to your own mongodb
Fix our endpoints so the POST endpoint will write reviews to your mongo database, and the GET endpoint will read the reviews from the database
click this link for Reference Sheet
app.get('/getADog', (req,res)=>{
MongoClient.connect(url, (err,db)=>{
if (err) throw err;
var dbo = db.db("dog-data")
dbo.collection("pups").findOne({}, (err,result)=>{
if (err) throw err;
let dog = result;
db.close();
res.send(JSON.stringify({dog}));
})
})
})