第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

當(dāng)我將數(shù)據(jù)提交到數(shù)據(jù)庫表時,我在瀏覽器控制臺中遇到此錯誤:未捕獲(承諾)錯誤:

當(dāng)我將數(shù)據(jù)提交到數(shù)據(jù)庫表時,我在瀏覽器控制臺中遇到此錯誤:未捕獲(承諾)錯誤:

MM們 2023-07-20 14:59:35
我在登錄頁面的反應(yīng)節(jié)點項目中面臨以下問題。到目前為止,我在每次執(zhí)行后一次又一次地檢查我的代碼,但仍然顯示錯誤。我想從登錄頁面將數(shù)據(jù)傳遞到我的 mysql 數(shù)據(jù)庫中。這是我申請的第一階段。createError.js:16 Uncaught (in promise) Error: Request failed with status code 404Login.js 文件..import React from "react";import "./Login.css";import jQuery from "jquery";import { useState } from "react";import Axios from "axios";const Login = () => {? const [userNameReg, setUserNameReg] = useState("");? const [emailReg, setEmailReg] = useState("");? const [passReg, setPassReg] = useState("");? const signup = () => {? ? Axios.post("http://localhost:3000/login", {? ? ? username: userNameReg,? ? ? email: emailReg,? ? ? password: passReg,? ? }).then((res) => {? ? ? console.log(res);? ? });? };? return (? ? <div>? ? ? <section className="account">? ? ? ? <div class="container" id="container">? ? ? ? ? <div class="form-container sign-up-container">? ? ? ? ? ? <form action="#">? ? ? ? ? ? ? <h1>Create Account</h1>? ? ? ? ? ? ? <div class="social-container">? ? ? ? ? ? ? ? <a href="#" class="social">? ? ? ? ? ? ? ? ? <i class="fab fa-facebook-f"></i>? ? ? ? ? ? ? ? </a>? ? ? ? ? ? ? ? <a href="#" class="social">? ? ? ? ? ? ? ? ? <i class="fab fa-google-plus-g"></i>? ? ? ? ? ? ? ? </a>? ? ? ? ? ? ? ? <a href="#" class="social">? ? ? ? ? ? ? ? ? <i class="fab fa-linkedin-in"></i>? ? ? ? ? ? ? ? </a>? ? ? ? ? ? ? </div>? ? ? ? ? ? ? <span>or use your email for registration</span>? ? ? ? ? ? ? <input? ? ? ? ? ? ? ? type="text"? ? ? ? ? ? ? ? placeholder="Name"? ? ? ? ? ? ? ? onChange={(e) => {? ? ? ? ? ? ? ? ? setUserNameReg(e.target.value);? ? ? ? ? ? ? ? }}? ? ? ? ? ? ? />? ? ? ? ? ? ? <input? ? ? ? ? ? ? ? type="email"? ? ? ? ? ? ? ? placeholder="Email"? ? ? ? ? ? ? ? onChange={(e) => {? ? ? ? ? ? ? ? ? setEmailReg(e.target.value);? ? ? ? ? ? ? ? }}
查看完整描述

1 回答

?
長風(fēng)秋雁

TA貢獻1757條經(jīng)驗 獲得超7個贊

你有你的app.listen帖子路由的內(nèi)部......所以服務(wù)器只會在收到帖子請求時開始偵聽傳入連接(它不能這樣做,因為它沒有偵聽)。將調(diào)用放在函數(shù)之外。


app.post("/login", (req, res) => {

  const username = req.body.username;

  const email = req.body.email;

  const password = req.body.password;


  db.query(

    "INSERT INTO signup (name, email,password) VALUES (?,?,?)",

    [username, email, password],

    (err, result) => {

      console.log(err);

    }

  );

});

app.listen(3000, () => {

    console.log("Everything Okay......");

  });


查看完整回答
反對 回復(fù) 2023-07-20
  • 1 回答
  • 0 關(guān)注
  • 146 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號