1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| const express = require("express"); const mysql = require("../db");
const router = express.Router();
router.post("/register", (req, res, next) => { const { username, password, sex, phone, email, address, age } = req.body; const sql = `insert into users(username,password,sex,phone,email,address,age) values (?,?,?,?,?,?,?)`; mysql.query( sql, [username, password, sex, phone, email, address, age], (err, data) => { if (err) { throw err; } if (data.affectedRows == 1) { res.send("新加板块成功!"); } } ); });
module.exports = router;
|