Speak now
Please Wait Image Converting Into Text...
Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Challenge yourself and boost your learning! Start the quiz now to earn credits.
Unlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
General Tech Bugs & Fixes 2 years ago
Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
Turn Your Knowledge into Earnings.
In section 10 he shows how to create routes for adding, deleting, updating and reading data in a mongoDB database using mongoose.
This is part of that code: // post.model.js const express = require('express'); const postRoutes = express.Router(); // Require Post model in our routes module let Post = require('./post.model'); // Defined store route postRoutes.route('/add').post(function (req, res) { let post = new Post(req.body); post.save() .then(() => { res.status(200).json({'business': 'business in added successfully'}); }) .catch(() => { res.status(400).send("unable to save to database"); }); });
Is there a specific reason he has put {'business': 'business in added successfully'} in the JSON for the 200 response? or can that just be anything? Also i'm not entirely sure what i would put in it for my specific scenario where i am trying to add, delete, update and read data about users in a 'users' collection.
{'business': 'business in added successfully'}
It can be anything, just to information that received request is successful and created the records. He added some response to that request.
No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
General Tech 9 Answers
General Tech 7 Answers
General Tech 3 Answers
General Tech 2 Answers
Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.