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
Show whitespace changes
Inline
Side-by-side
client/debug.log
View file @
791c9a51
[0102/195101.790:ERROR:directory_reader_win.cc(43)] FindFirstFile: 지정된 경로를 찾을 수 없습니다. (0x3)
[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';
...
@@ -7,6 +7,7 @@ import option from '../option.svg';
function
MainNav
()
{
function
MainNav
()
{
function
handleClick
()
{
function
handleClick
()
{
alert
(
'
로그아웃이 완료되었습니다.
'
)
alert
(
'
로그아웃이 완료되었습니다.
'
)
window
.
location
.
href
=
"
/home
"
}
}
return
(
return
(
...
...
client/src/Components/SubNav.js
View file @
791c9a51
...
@@ -22,7 +22,7 @@ function SubNav() {
...
@@ -22,7 +22,7 @@ function SubNav() {
}
}
return
(
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
"
>
<
style
type
=
"
text/css
"
>
{
`
{
`
.nav-link, .nav-link:hover, .nav-link:active {
.nav-link, .nav-link:hover, .nav-link:active {
...
...
client/src/Pages/Signup.js
View file @
791c9a51
...
@@ -100,12 +100,12 @@ function Signup() {
...
@@ -100,12 +100,12 @@ function Signup() {
<
Form
.
Row
>
<
Form
.
Row
>
<
Col
sm
=
{
4
}
xs
=
{
6
}
as
=
{
Form
.
Label
}
for
=
"
number
"
>
주민등록번호
<
/Col
>
<
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
<
Form
.
Control
required
type
=
"
text
"
required
type
=
"
text
"
name
=
"
number1
"
name
=
"
number1
"
maxlength
=
"
6
"
maxlength
=
"
6
"
className
=
"
mx-2
"
style
=
{{
width
:
'
170px
'
}}
className
=
"
mx-2
"
style
=
{{
width
:
'
17
0px
'
}}
value
=
{
user
.
number1
}
value
=
{
user
.
number1
}
onChange
=
{
handleChange
}
>
onChange
=
{
handleChange
}
>
<
/Form.Control
>
<
/Form.Control
>
...
@@ -114,7 +114,7 @@ function Signup() {
...
@@ -114,7 +114,7 @@ function Signup() {
required
type
=
"
text
"
required
type
=
"
text
"
name
=
"
number2
"
name
=
"
number2
"
maxlength
=
"
1
"
className
=
"
mx-3
"
maxlength
=
"
1
"
className
=
"
mx-3
"
style
=
{{
width
:
'
2
5px
'
}}
style
=
{{
width
:
'
5
0
px
'
}}
value
=
{
user
.
number2
}
value
=
{
user
.
number2
}
onChange
=
{
handleChange
}
>
onChange
=
{
handleChange
}
>
<
/Form.Control
>
<
/Form.Control
>
...
...
server/app.js
View file @
791c9a51
...
@@ -33,7 +33,7 @@ app.use(express.json());
...
@@ -33,7 +33,7 @@ app.use(express.json());
// app.listen(port, () => console.log(port));
// app.listen(port, () => console.log(port));
app
.
listen
(
3001
,
()
=>
console
.
log
(
'
Listenning
'
));
app
.
listen
(
3001
,
()
=>
console
.
log
(
'
Listenning
'
));
app
.
use
(
userRouter
)
app
.
use
(
'
/api/users
'
,
userRouter
)
// catch 404 and forward to error handler
// catch 404 and forward to error handler
// app.use(function(req, res, next) {
// app.use(function(req, res, next) {
...
...
server/controllers/user.controller.js
View file @
791c9a51
...
@@ -2,14 +2,17 @@ import User from "../models/User.js";
...
@@ -2,14 +2,17 @@ import User from "../models/User.js";
import
isLength
from
'
validator/lib/isLength.js
'
import
isLength
from
'
validator/lib/isLength.js
'
const
signup
=
async
(
req
,
res
)
=>
{
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
{
try
{
if
(
!
isLength
(
password
,{
min
:
8
,
max
:
15
})){
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
({
const
newUser
=
await
new
User
({
name
,
name
,
number
,
number1
,
number2
,
id
,
id
,
password
,
password
,
password2
,
password2
,
...
@@ -20,7 +23,7 @@ const signup = async (req, res) => {
...
@@ -20,7 +23,7 @@ const signup = async (req, res) => {
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
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({
...
@@ -15,12 +15,15 @@ const UserSchema = new mongoose.Schema({
password
:
{
password
:
{
type
:
String
,
type
:
String
,
required
:
true
,
required
:
true
,
select
:
true
,
},
},
number
:{
number1
:{
type
:
String
,
required
:
true
,
unique
:
true
},
number2
:{
type
:
String
,
type
:
String
,
required
:
true
,
required
:
true
,
select
:
true
,
unique
:
true
unique
:
true
},
},
tel
:{
tel
:{
...
...
server/routes/user.routes.js
View file @
791c9a51
...
@@ -3,7 +3,7 @@ import userCtrl from '../controllers/user.controller.js';
...
@@ -3,7 +3,7 @@ import userCtrl from '../controllers/user.controller.js';
const
router
=
express
.
Router
()
const
router
=
express
.
Router
()
router
.
route
(
'
/
api/users/
signup
'
)
router
.
route
(
'
/signup
'
)
.
post
(
userCtrl
.
signup
)
.
post
(
userCtrl
.
signup
)
.
get
(
userCtrl
.
hello
)
.
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