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
Show whitespace changes
Inline
Side-by-side
client/src/components/SignUp.js
View file @
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
}
...
...
controllers/room.controller.js
View file @
e55ec2b6
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
,
};
};
controllers/user.controller.js
View file @
e55ec2b6
...
@@ -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
(
"
회원가입 중 에러
"
);
...
...
index.js
View file @
e55ec2b6
...
@@ -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!
"
,
...
...
models/index.js
View file @
e55ec2b6
...
@@ -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
};
models/user.model.js
View file @
e55ec2b6
...
@@ -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
,
...
...
routes/room.route.js
View file @
e55ec2b6
...
@@ -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
;
routes/user.route.js
View file @
e55ec2b6
...
@@ -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
;
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