0
1

More than 1 year has passed since last update.

Nodejs + React + MySQL+ Express Todoアプリ

Posted at

image.png

開発環境

image.png

参考動画

使用したパッケージ

バックエンド

image.png

terminal
 npm install body-parser cors dotenv express mysql2 nodemon

フロントエンド

image.png

terminal
 npm install axios react-router-dom react-toastify

完成品

image.png

MySQLと接続

index.js
 const mysql = require("mysql2");

 const db = mysql.createPool({
  host: process.env.HOST,
  user: "root",
  password: "",
  database: "crud_contact",
});

Axios 全データの取得

Home.jsx
 const [data, setData] = useState([]);

 const loadData = async () => {
    const response = await axios.get("http://localhost:5000/api/get");
    setData(response.data);
  };

参考資料

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1