我通过POSTMAN遇到这样的问题,无法发送POST请求,可能是什么问题? 邮递员控制台:
Error: localhost request not supported Network Request Headers User-Agent: PostmanRuntime/7.32.2 Accept: */* Cache-Control: no-cache Postman-Token: 815c2340-5ac3-4ab4-91be-8d62a5d6333b Host: localhost:8800 Accept-Encoding: gzip, deflate, br Connection: keep-alive
import User from "../models/user.model.js";
export const register = async (req,res)=> {
try {
const newUser = new User(req.body);
await newUser.save();
res.status(201).send("User has been created.");
} catch (err) {
res.status(500).send("Something went wrong!");
}
};
//export const login = async (req,res)=> {};
//export const logout = async (req,res)=> {};
import express from "express";
import { register, } from "../controllers/auth.controller.js";
const router = express.Router();
router.post("/register", register)
//router.post("/login", login)
//router.post("/logout", logout)
export default router;
我是初学者,这是我第一次使用POSTMAN,所以不要太严厉地评判)