Commit 791c9a51 authored by 이재연's avatar 이재연
Browse files

signup data

parent ea8ae1a0
[0102/195101.790:ERROR:directory_reader_win.cc(43)] FindFirstFile: 지정된 경로를 찾을 수 없습니다. (0x3)
[0104/152743.507:ERROR:directory_reader_win.cc(43)] FindFirstFile: 지정된 경로를 찾을 수 없습니다. (0x3)
......@@ -7,6 +7,7 @@ import option from '../option.svg';
function MainNav() {
function handleClick() {
alert('로그아웃이 완료되었습니다.')
window.location.href="/home"
}
return (
......
......@@ -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 {
......
......@@ -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={12} >
<Col as={Row} sm={8} xs={10} >
<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: '25px' }}
style={{ width: '50px' }}
value={user.number2}
onChange={handleChange}>
</Form.Control>
......
......@@ -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) {
......
......@@ -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:'죄송합니다. 다시 입력해 주십시오.'})
}
}
......
......@@ -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:{
......
......@@ -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)
......
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