We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
// 查询所有用户 router.get("/users", async (ctx, next) => { const sql = "SELECT * FROM users" connection.query(sql, (err, results, fields) => { if (err) { console.error(err) ctx.body = { success: false, message: "查询失败" } return } console.log("get", results) ctx.body = { success: true, data: results } }) })
我根路由都访问成功,这个路由咋404,但是数据库写进去了而且读成功,console 那行成功有正确数据
The text was updated successfully, but these errors were encountered:
哦,知道原因了,好像是 mysql 造成的。我把 npm i mysql 改用 npm i mysql2 就成功了
npm i mysql
npm i mysql2
Sorry, something went wrong.
No branches or pull requests
我根路由都访问成功,这个路由咋404,但是数据库写进去了而且读成功,console 那行成功有正确数据
The text was updated successfully, but these errors were encountered: