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
shopping-mall
Commits
791c9a51
Commit
791c9a51
authored
Jan 04, 2021
by
이재연
Browse files
signup data
parent
ea8ae1a0
Changes
8
Hide whitespace changes
Inline
Side-by-side
client/debug.log
View file @
791c9a51
[0102/195101.790:ERROR:directory_reader_win.cc(43)] FindFirstFile: 지정된 경로를 찾을 수 없습니다. (0x3)
[0104/152743.507:ERROR:directory_reader_win.cc(43)] FindFirstFile: 지정된 경로를 찾을 수 없습니다. (0x3)
client/src/Components/MainNav.js
View file @
791c9a51
...
...
@@ -7,6 +7,7 @@ import option from '../option.svg';
function
MainNav
()
{
function
handleClick
()
{
alert
(
'
로그아웃이 완료되었습니다.
'
)
window
.
location
.
href
=
"
/home
"
}
return
(
...
...
client/src/Components/SubNav.js
View file @
791c9a51
...
...
@@ -22,7 +22,7 @@ function SubNav() {
}
return
(
<
Navbar
sticky
=
"
top
"
className
=
"
flex-nowrap
"
style
=
{{
top
:
"
62px
"
,
paddingTop
:
"
0
"
,
paddingBottom
:
"
0
"
,
backgroundColor
:
"
#fff
"
}}
>
<
Navbar
sticky
=
"
top
"
className
=
"
flex-nowrap
"
style
=
{{
top
:
"
62px
"
,
paddingTop
:
"
0
"
,
paddingBottom
:
"
0
"
,
backgroundColor
:
"
#fff
"
,
overflowX
:
"
auto
"
}}
>
<
style
type
=
"
text/css
"
>
{
`
.nav-link, .nav-link:hover, .nav-link:active {
...
...
client/src/Pages/Signup.js
View file @
791c9a51
...
...
@@ -100,12 +100,12 @@ function Signup() {
<
Form
.
Row
>
<
Col
sm
=
{
4
}
xs
=
{
6
}
as
=
{
Form
.
Label
}
for
=
"
number
"
>
주민등록번호
<
/Col
>
<
Col
as
=
{
Row
}
sm
=
{
8
}
xs
=
{
1
2
}
>
<
Col
as
=
{
Row
}
sm
=
{
8
}
xs
=
{
1
0
}
>
<
Form
.
Control
required
type
=
"
text
"
name
=
"
number1
"
maxlength
=
"
6
"
className
=
"
mx-2
"
style
=
{{
width
:
'
170px
'
}}
className
=
"
mx-2
"
style
=
{{
width
:
'
17
0px
'
}}
value
=
{
user
.
number1
}
onChange
=
{
handleChange
}
>
<
/Form.Control
>
...
...
@@ -114,7 +114,7 @@ function Signup() {
required
type
=
"
text
"
name
=
"
number2
"
maxlength
=
"
1
"
className
=
"
mx-3
"
style
=
{{
width
:
'
2
5px
'
}}
style
=
{{
width
:
'
5
0
px
'
}}
value
=
{
user
.
number2
}
onChange
=
{
handleChange
}
>
<
/Form.Control
>
...
...
server/app.js
View file @
791c9a51
...
...
@@ -33,7 +33,7 @@ app.use(express.json());
// app.listen(port, () => console.log(port));
app
.
listen
(
3001
,
()
=>
console
.
log
(
'
Listenning
'
));
app
.
use
(
userRouter
)
app
.
use
(
'
/api/users
'
,
userRouter
)
// catch 404 and forward to error handler
// app.use(function(req, res, next) {
...
...
server/controllers/user.controller.js
View file @
791c9a51
...
...
@@ -2,14 +2,17 @@ import User from "../models/User.js";
import
isLength
from
'
validator/lib/isLength.js
'
const
signup
=
async
(
req
,
res
)
=>
{
const
{
name
,
number
,
id
,
password
,
password2
,
tel
}
=
req
.
body
console
.
log
(
req
.
body
)
console
.
log
(
'
req.body.name=
'
,
req
.
body
.
name
)
const
{
name
,
number1
,
number2
,
id
,
password
,
password2
,
tel
}
=
req
.
body
try
{
if
(
!
isLength
(
password
,{
min
:
8
,
max
:
15
})){
return
res
.
status
(
422
).
send
(
'
비밀번호는 8-15자리로 입력해주세요.
'
)
return
res
.
status
(
422
).
json
({
message
:
'
비밀번호는 8-15자리로 입력해주세요.
'
}
)
}
const
newUser
=
await
new
User
({
name
,
number
,
number1
,
number2
,
id
,
password
,
password2
,
...
...
@@ -20,7 +23,7 @@ const signup = async (req, res) => {
}
catch
(
error
)
{
console
.
log
(
error
)
res
.
status
(
500
).
send
(
'
죄송합니다. 다시 입력해 주십시오.
'
)
res
.
status
(
500
).
json
({
message
:
'
죄송합니다. 다시 입력해 주십시오.
'
}
)
}
}
...
...
server/models/User.js
View file @
791c9a51
...
...
@@ -15,12 +15,15 @@ const UserSchema = new mongoose.Schema({
password
:
{
type
:
String
,
required
:
true
,
select
:
true
,
},
number
:{
number1
:{
type
:
String
,
required
:
true
,
unique
:
true
},
number2
:{
type
:
String
,
required
:
true
,
select
:
true
,
unique
:
true
},
tel
:{
...
...
server/routes/user.routes.js
View file @
791c9a51
...
...
@@ -3,7 +3,7 @@ import userCtrl from '../controllers/user.controller.js';
const
router
=
express
.
Router
()
router
.
route
(
'
/
api/users/
signup
'
)
router
.
route
(
'
/signup
'
)
.
post
(
userCtrl
.
signup
)
.
get
(
userCtrl
.
hello
)
...
...
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