Commit a4bff5ef authored by Kim, Chaerin's avatar Kim, Chaerin
Browse files

Merge branch 'cherry2' into 'master'

서버

See merge request research/bora_it!8
parents 2baaacfd e55ec2b6
...@@ -5,7 +5,7 @@ const INIT_USER = { ...@@ -5,7 +5,7 @@ const INIT_USER = {
name: "", name: "",
idNumber1: "", idNumber1: "",
idNumber2: "", idNumber2: "",
id: "", email: "",
password: "", password: "",
checkpw: "", checkpw: "",
phone: "", phone: "",
...@@ -23,7 +23,7 @@ const Signup = () => { ...@@ -23,7 +23,7 @@ const Signup = () => {
user.name && user.name &&
user.idNumber1 && user.idNumber1 &&
user.idNumber2 && user.idNumber2 &&
user.id && user.email &&
user.password && user.password &&
user.checkpw user.checkpw
) )
...@@ -115,9 +115,9 @@ const Signup = () => { ...@@ -115,9 +115,9 @@ const Signup = () => {
<label className="p-1">아이디</label> <label className="p-1">아이디</label>
<input <input
className="form-control" className="form-control"
id="id" id="text"
type="text" type="text"
name="id" name="email"
placeholder="아이디를 입력하세요" placeholder="아이디를 입력하세요"
value={id} value={id}
onChange={handleChange} onChange={handleChange}
......
import { Room } from "../models/index.js"; import { Room } from "../models/index.js";
import config from "../config/app.config.js";
const login = async (req, res) => { const test = async (req, res) => {
try { try {
console.log("room= ", req.body); console.log("room= ", req.body);
res.json("안녕"); res.json("안녕");
...@@ -12,5 +11,5 @@ const login = async (req, res) => { ...@@ -12,5 +11,5 @@ const login = async (req, res) => {
}; };
export default { export default {
login, test,
}; };
...@@ -43,6 +43,8 @@ const login = async (req, res) => { ...@@ -43,6 +43,8 @@ const login = async (req, res) => {
const signup = async (req, res) => { const signup = async (req, res) => {
try { try {
console.log("sign up= ", req.body); console.log("sign up= ", req.body);
const { id, name, email, password, gender, phone } = req.body;
const user = User.create({ id, name, email, password, gender, phone });
} catch (error) { } catch (error) {
console.log(error); console.log(error);
return res.status(500).send("회원가입 중 에러"); return res.status(500).send("회원가입 중 에러");
......
...@@ -15,6 +15,7 @@ sequelize ...@@ -15,6 +15,7 @@ sequelize
.then(async () => { .then(async () => {
console.log(" DB 연결 성공"); console.log(" DB 연결 성공");
await User.create({ await User.create({
id: 9999,
name: "admin", name: "admin",
email: "admin", email: "admin",
password: "admin!", password: "admin!",
......
...@@ -16,4 +16,6 @@ const sequelize = new Sequelize( ...@@ -16,4 +16,6 @@ const sequelize = new Sequelize(
const User = UserModel(sequelize); const User = UserModel(sequelize);
const Room = RoomModel(sequelize); const Room = RoomModel(sequelize);
User.hasMany(Room);
export { sequelize, User, Room }; export { sequelize, User, Room };
...@@ -8,7 +8,6 @@ const UserModel = (sequelize) => { ...@@ -8,7 +8,6 @@ const UserModel = (sequelize) => {
id: { id: {
type: DataTypes.INTEGER, type: DataTypes.INTEGER,
primaryKey: true, primaryKey: true,
autoIncrement: true,
}, },
name: { name: {
type: DataTypes.STRING, type: DataTypes.STRING,
......
...@@ -3,6 +3,6 @@ import roomCrtl from "../controllers/room.controller.js"; ...@@ -3,6 +3,6 @@ import roomCrtl from "../controllers/room.controller.js";
const router = express.Router(); const router = express.Router();
router.route("/").post(roomCrtl.login); router.route("/").post(roomCrtl.test);
export default router; export default router;
...@@ -4,6 +4,6 @@ import userCtrl from "../controllers/user.controller.js"; ...@@ -4,6 +4,6 @@ import userCtrl from "../controllers/user.controller.js";
const router = express.Router(); const router = express.Router();
router.route("/login").post(userCtrl.login); router.route("/login").post(userCtrl.login);
router.route("/signup").post(userCtrl.test); router.route("/signup").post(userCtrl.signup);
export default router; export default router;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment