'what does it mean when a http post request outputs this result: "_id": "627a0a15d6781db12a66f038"?
All i want to do is log the input gotten from the frontend to the console. Im using postman to test the operations. However the results i've been getting are really confusing. I have searched several solutions, but non really helped solve the problem.
so here's the code:
app.use(bodyParser.urlencoded({
extended: true
}));
app.use(bodyParser.json());
app.get("/", (req, res) => {
res.send ("HomePage");
});
app.post("/add", (req, res) => {
const newTodo = new Todo(req.body);
res.send(newTodo);
})
pls note the model Todo was to format the incoming request according to the schema defined in another file.
const mongoose= require("mongoose");
const TodoSchema = new mongoose.Schema({
todo:{
type: String,
required: true,
trim: true,
createdAt: Date.now
},
});
module.exports = new mongoose.model("Todo", TodoSchema);
Here's the Output im getting:
{
"_id": "627a0a15d6781db12a66f038"
}
After inputting this for example:
"Go hiking"
Why am i not getting the input as my result?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
