我已经按照教程成功地设置了一个注册系统,并且一直在尝试获取自己的数据来 POST 我的 MongoDB,但是 Postman 请求永远发送。我不确定我是否遗漏了某些内容或者我是否使用了不正确的语法?
\n\n我只是想为我的 \xe2\x80\x98Hobby\xe2\x80\x99 模型发布两个字符串。
\n\nhobbies.js (api) 包含在 paths/api 中。
\n\nconst express = require("express");\nconst router = express.Router();\nconst mongoose = require("mongoose");\n\nconst Hobbies = require("../models/Hobby");\n\n// @route GET api/posts/test\n// @desc Tests post routes\n// @access Public - (Private routes are for registered and logged in users)\nrouter.get("/test", (req, res) => res.json({ msg: "Hobbies page Works" }));\n\nrouter.post("/newhobby", (req, res) => {\n //else create the new user in the DB using the data input by user\n const newHobby = new …Run Code Online (Sandbox Code Playgroud)