Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
bora-it
Commits
e55ec2b6
Commit
e55ec2b6
authored
Jul 16, 2021
by
Kim, Chaerin
Browse files
서버
parent
2baaacfd
Changes
8
Hide whitespace changes
Inline
Side-by-side
client/src/components/SignUp.js
View file @
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
}
...
...
controllers/room.controller.js
View file @
e55ec2b6
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
,
};
controllers/user.controller.js
View file @
e55ec2b6
...
...
@@ -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
(
"
회원가입 중 에러
"
);
...
...
index.js
View file @
e55ec2b6
...
...
@@ -15,6 +15,7 @@ sequelize
.
then
(
async
()
=>
{
console
.
log
(
"
DB 연결 성공
"
);
await
User
.
create
({
id
:
9999
,
name
:
"
admin
"
,
email
:
"
admin
"
,
password
:
"
admin!
"
,
...
...
models/index.js
View file @
e55ec2b6
...
...
@@ -16,4 +16,6 @@ const sequelize = new Sequelize(
const
User
=
UserModel
(
sequelize
);
const
Room
=
RoomModel
(
sequelize
);
User
.
hasMany
(
Room
);
export
{
sequelize
,
User
,
Room
};
models/user.model.js
View file @
e55ec2b6
...
...
@@ -8,7 +8,6 @@ const UserModel = (sequelize) => {
id
:
{
type
:
DataTypes
.
INTEGER
,
primaryKey
:
true
,
autoIncrement
:
true
,
},
name
:
{
type
:
DataTypes
.
STRING
,
...
...
routes/room.route.js
View file @
e55ec2b6
...
...
@@ -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
;
routes/user.route.js
View file @
e55ec2b6
...
...
@@ -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
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment