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 = {
name: "",
idNumber1: "",
idNumber2: "",
id: "",
email: "",
password: "",
checkpw: "",
phone: "",
......@@ -23,7 +23,7 @@ const Signup = () => {
user.name &&
user.idNumber1 &&
user.idNumber2 &&
user.id &&
user.email &&
user.password &&
user.checkpw
)
......@@ -115,9 +115,9 @@ const Signup = () => {
<label className="p-1">아이디</label>
<input
className="form-control"
id="id"
id="text"
type="text"
name="id"
name="email"
placeholder="아이디를 입력하세요"
value={id}
onChange={handleChange}
......
import { Room } from "../models/index.js";
import config from "../config/app.config.js";
const login = async (req, res) => {
const test = async (req, res) => {
try {
console.log("room= ", req.body);
res.json("안녕");
......@@ -12,5 +11,5 @@ const login = async (req, res) => {
};
export default {
login,
test,
};
......@@ -43,6 +43,8 @@ const login = async (req, res) => {
const signup = async (req, res) => {
try {
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) {
console.log(error);
return res.status(500).send("회원가입 중 에러");
......
......@@ -15,6 +15,7 @@ sequelize
.then(async () => {
console.log(" DB 연결 성공");
await User.create({
id: 9999,
name: "admin",
email: "admin",
password: "admin!",
......
......@@ -16,4 +16,6 @@ const sequelize = new Sequelize(
const User = UserModel(sequelize);
const Room = RoomModel(sequelize);
User.hasMany(Room);
export { sequelize, User, Room };
......@@ -8,7 +8,6 @@ const UserModel = (sequelize) => {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
name: {
type: DataTypes.STRING,
......
......@@ -3,6 +3,6 @@ import roomCrtl from "../controllers/room.controller.js";
const router = express.Router();
router.route("/").post(roomCrtl.login);
router.route("/").post(roomCrtl.test);
export default router;
......@@ -4,6 +4,6 @@ import userCtrl from "../controllers/user.controller.js";
const router = express.Router();
router.route("/login").post(userCtrl.login);
router.route("/signup").post(userCtrl.test);
router.route("/signup").post(userCtrl.signup);
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