Commit ea09b940 authored by 이재연's avatar 이재연
Browse files

Merge remote-tracking branch 'origin/ourMaster' into jaeyeon

parents 4ab77077 cc144908
...@@ -10,19 +10,19 @@ function MainNav() { ...@@ -10,19 +10,19 @@ function MainNav() {
} }
return ( return (
<Navbar fixed="top" bg="dark" variant="dark" style={{position: "sticky"}}> <Navbar sticky="top" style={{ background: "#CDC5C2" }}>
<Navbar.Brand href="/home"> <Navbar.Brand href="/home" className="text-light">
<img src={logo} width="23" height="23" /> <img src={logo} width="24" height="24" />
{' '}KU# {' '}KU#
</Navbar.Brand> </Navbar.Brand>
<Nav className="justify-content-end"> <Nav className="justify-content-end">
<Nav.Link href="/login">Login</Nav.Link> <Nav.Link className="text-light" href="/login">Login</Nav.Link>
<Nav.Link href="/signup">Signup</Nav.Link> <Nav.Link className="text-light" href="/signup">Signup</Nav.Link>
<Nav.Link href="/shoppingcart"> <Nav.Link href="/shoppingcart">
<img src={cart} width="30" height="30" /> <img src={cart} width="30" height="30" />
</Nav.Link> </Nav.Link>
<Nav.Link onClick={() => handleClick()}>Logout</Nav.Link> <Nav.Link className="text-light" onClick={() => handleClick()}>Logout</Nav.Link>
<Nav.Link href="/admin/:id"> <Nav.Link href="/admin">
<img src={option} width="30" height="30" /> <img src={option} width="30" height="30" />
</Nav.Link> </Nav.Link>
</Nav> </Nav>
......
...@@ -13,7 +13,7 @@ function pagination() { ...@@ -13,7 +13,7 @@ function pagination() {
} }
return ( return (
<Pagination className="justify-content-center mt-5">{items}</Pagination> <Pagination className="justify-content-center">{items}</Pagination>
) )
} }
......
import React, { useState, useEffect, useRef } from 'react'; import React, { useState, useEffect, useRef } from 'react';
import { Redirect } from 'react-router-dom'; import { Redirect } from 'react-router-dom';
import { Nav, NavDropdown } from 'react-bootstrap'; import { Navbar, Nav, NavDropdown } from 'react-bootstrap';
function SubNav() { function SubNav() {
const [toggle, setToggle] = useState({ "dress": false, "outer": false, "top": false, "pants": false, "skirt": false, "training": false, "shoes": false }); const [toggle, setToggle] = useState({ "dress": false, "outer": false, "top": false, "pants": false, "skirt": false, "training": false, "shoes": false });
...@@ -22,7 +22,35 @@ function SubNav() { ...@@ -22,7 +22,35 @@ function SubNav() {
} }
return ( return (
<Nav fixed="top" className="flex-nowrap" style={{overflowX: "auto"}}> <Navbar sticky="top" className="flex-nowrap" style={{ top: "62px", paddingTop: "0", paddingBottom: "0", backgroundColor: "#fff" }}>
<style type="text/css">
{`
.nav-link, .nav-link:hover, .nav-link:active {
color: #91877F;
}
.dropdown-toggle:after {
display: none;
}
.dropdown-menu {
background-color: #91877F;
}
.dropdown-item {
color: #f8f9fa;
}
.dropdown-item:focus, .dropdown-item:hover {
color: #91877F;
}
.dropdown-item:active {
background-color: #f8f9fa;
}
`}
</style>
<Nav>
<NavDropdown title="DRESS" onMouseEnter={() => handleMouseEnter("dress")} onMouseLeave={() => handleMouseLeave("dress")} show={toggle.dress} toggle={() => handleToggle("dress")} onClick={() => handleClick("/dress")}> <NavDropdown title="DRESS" onMouseEnter={() => handleMouseEnter("dress")} onMouseLeave={() => handleMouseLeave("dress")} show={toggle.dress} toggle={() => handleToggle("dress")} onClick={() => handleClick("/dress")}>
<NavDropdown.Item href="/dress/long">LONG DRESS</NavDropdown.Item> <NavDropdown.Item href="/dress/long">LONG DRESS</NavDropdown.Item>
<NavDropdown.Item href="/dress/short">SHORT DRESS</NavDropdown.Item> <NavDropdown.Item href="/dress/short">SHORT DRESS</NavDropdown.Item>
...@@ -78,6 +106,7 @@ function SubNav() { ...@@ -78,6 +106,7 @@ function SubNav() {
<NavDropdown.Item href="/skirt/sandal_slipper">SANDAL / SLIPPER</NavDropdown.Item> <NavDropdown.Item href="/skirt/sandal_slipper">SANDAL / SLIPPER</NavDropdown.Item>
</NavDropdown> </NavDropdown>
</Nav> </Nav>
</Navbar>
) )
} }
......
import React, { useState, useEffect, useRef } from 'react'; import React, { useState, useEffect, useRef } from 'react';
import { Redirect } from 'react-router-dom';
import MainNav from '../Components/MainNav'; import MainNav from '../Components/MainNav';
import SubNav from '../Components/SubNav'; import SubNav from '../Components/SubNav';
import Pagination from '../Components/Pagination'; import Pagination from '../Components/Pagination';
...@@ -7,89 +6,114 @@ import search from '../search.svg'; ...@@ -7,89 +6,114 @@ import search from '../search.svg';
import { Row, Col, Form, FormControl, Button, Card } from 'react-bootstrap'; import { Row, Col, Form, FormControl, Button, Card } from 'react-bootstrap';
function Admin() { function Admin() {
function handleClick(e) {
const card = e.target.parentNode.parentNode
console.log(card)
alert('해당 상품을 성공적으로 삭제하였습니다.')
}
return ( return (
<div> <div>
<style type="text/css">
{`
.btn {
background-color: #CDC5C2;
border-color: #CDC5C2;
}
.btn:hover, .btn:active, .btn:focus {
background-color: #91877F;
border-color: #91877F;
}
`}
</style>
<MainNav /> <MainNav />
<SubNav /> <SubNav />
<Row className="justify-content-end mt-5 mr-3"> <Row className="justify-content-end mt-5 mr-3 mb-5">
<Col md={4} sm={5} xs={8} as={Form} inline className="justify-content-end"> <Col as={Form} inline className="justify-content-end">
<FormControl type="text" placeholder="Search" className="mr-1" /> <FormControl type="text" placeholder="Search" className="mr-1" />
<Button bg="dark" variant="dark" type="submit" className="px-2"> <Button type="submit" className="px-2">
<img src={search} width="20" height="20" /> <img src={search} width="20" height="20" />
</Button> </Button>
</Col> </Col>
<Col sm={2} xs={3} as={Button} variant="dark" type="button" href="/:id/productsregist">상품 등록</Col> <Col sm={2} xs={3} as={Button} type="button" href="/regist">상품 등록</Col>
</Row> </Row>
<Row className="mt-5 m-auto justify-content-start"> <Row className="justify-content-start m-5">
<Card className="m-4" style={{width: "18rem"}}> <Card className="my-5" style={{ width: "18rem", margin: "auto"}}>
<Card.Img variant="top" src="https://img.sonyunara.com/files/goods/67460/1607053816_0.jpg" /> <Card.Img variant="top" src="https://img.sonyunara.com/files/goods/67460/1607053816_0.jpg" style={{ objectFit: "contain", height: "22rem" }} />
<Card.Body> <Card.Body>
<Card.Title>케이시앵글부츠(SH)</Card.Title> <Card.Title>케이시앵글부츠(SH)</Card.Title>
<Card.Text> <Card.Text>
재고: 8 재고: 8<br />
구매자 : 10 구매자 : 10
</Card.Text> </Card.Text>
<Button className="float-right" onClick={(e) => handleClick(e)}>삭제</Button>
</Card.Body> </Card.Body>
</Card> </Card>
<Card className="m-4" style={{width: "18rem"}}> <Card className="my-5" style={{ width: "18rem", margin: "auto"}}>
<Card.Img variant="top" src="https://img.sonyunara.com/files/goods/48705/1552562469_0.jpg" /> <Card.Img variant="top" src="https://img.sonyunara.com/files/goods/48705/1552562469_0.jpg" style={{ objectFit: "contain", height: "22rem" }} />
<Card.Body> <Card.Body>
<Card.Title>메리제인플랫(SH)</Card.Title> <Card.Title>메리제인플랫(SH)</Card.Title>
<Card.Text> <Card.Text>
재고: 20 재고: 20<br />
구매자 : 60 구매자 : 60
</Card.Text> </Card.Text>
<Button className="float-right" onClick={(e) => handleClick(e)}>삭제</Button>
</Card.Body> </Card.Body>
</Card> </Card>
<Card className="m-4" style={{width: "18rem"}}> <Card className="my-5" style={{ width: "18rem", margin: "auto"}}>
<Card.Img variant="top" src="https://img.sonyunara.com/files/goods/53386/1567390097_2.jpg" /> <Card.Img variant="top" src="https://img.sonyunara.com/files/goods/53386/1567390097_2.jpg" style={{ objectFit: "contain", height: "22rem" }} />
<Card.Body> <Card.Body>
<Card.Title>솔티드스니커즈(SH)</Card.Title> <Card.Title>솔티드스니커즈(SH)</Card.Title>
<Card.Text> <Card.Text>
재고: 34 재고: 34<br />
구매자 : 5 구매자 : 5
</Card.Text> </Card.Text>
<Button className="float-right" onClick={(e) => handleClick(e)}>삭제</Button>
</Card.Body> </Card.Body>
</Card> </Card>
<Card className="m-4" style={{width: "18rem"}}> <Card className="my-5" style={{ width: "18rem", margin: "auto"}}>
<Card.Img variant="top" src="https://img.sonyunara.com/files/goods/61286/1587540563_0.jpg" /> <Card.Img variant="top" src="https://img.sonyunara.com/files/goods/61286/1587540563_0.jpg" style={{ objectFit: "contain", height: "22rem" }} />
<Card.Body> <Card.Body>
<Card.Title>버켄슬리퍼(SH)</Card.Title> <Card.Title>버켄슬리퍼(SH)</Card.Title>
<Card.Text> <Card.Text>
재고: 재고: 50<br />
구매자 : 구매자 : 18
</Card.Text> </Card.Text>
<Button className="float-right" onClick={(e) => handleClick(e)}>삭제</Button>
</Card.Body> </Card.Body>
</Card> </Card>
<Card className="m-4" style={{width: "18rem"}}> <Card className="my-5" style={{ width: "18rem", margin: "auto"}}>
<Card.Img variant="top" src="https://hotping.co.kr/web/product/big/202011/b8f4c6471955b80fc3991b7d6df8926a.jpg" /> <Card.Img variant="top" src="https://hotping.co.kr/web/product/big/202011/b8f4c6471955b80fc3991b7d6df8926a.jpg" style={{ objectFit: "contain", height: "22rem" }} />
<Card.Body> <Card.Body>
<Card.Title>크레센도 하이힐펌프스</Card.Title> <Card.Title>크레센도 하이힐펌프스</Card.Title>
<Card.Text> <Card.Text>
재고: 35 재고: 35<br />
구매자 : 70 구매자 : 70
</Card.Text> </Card.Text>
<Button className="float-right" onClick={(e) => handleClick(e)}>삭제</Button>
</Card.Body> </Card.Body>
</Card> </Card>
<Card className="m-4" style={{width: "18rem"}}> <Card className="my-5" style={{ width: "18rem", margin: "auto"}}>
<Card.Img variant="top" src="https://hotping.co.kr/web/product/big/202011/888e4e8d6a2c2e7da385b079151fcba2.jpg" /> <Card.Img variant="top" src="https://hotping.co.kr/web/product/big/202011/888e4e8d6a2c2e7da385b079151fcba2.jpg" style={{ objectFit: "contain", height: "22rem" }} />
<Card.Body> <Card.Body>
<Card.Title>어텀솔져1cm 스웨이드로퍼</Card.Title> <Card.Title>어텀솔져1cm 스웨이드로퍼</Card.Title>
<Card.Text> <Card.Text>
재고: 40 재고: 40<br />
구매자 : 30 구매자 : 30
</Card.Text> </Card.Text>
<Button className="float-right" onClick={(e) => handleClick(e)}>삭제</Button>
</Card.Body> </Card.Body>
</Card> </Card>
<Card className="m-4" style={{width: "18rem"}}> <Card className="my-5" style={{ width: "18rem", margin: "auto"}}>
<Card.Img variant="top" src="https://hotping.co.kr/web/product/big/202007/3308564012eb14e6c11ed621fa7555fb.jpg" /> <Card.Img variant="top" src="https://hotping.co.kr/web/product/big/202007/3308564012eb14e6c11ed621fa7555fb.jpg" style={{ objectFit: "contain", height: "22rem" }} />
<Card.Body> <Card.Body>
<Card.Title>포웰3.5cm 스니커즈</Card.Title> <Card.Title>포웰3.5cm 스니커즈</Card.Title>
<Card.Text> <Card.Text>
재고: 15 재고: 15<br />
구매자 : 50 구매자 : 50
</Card.Text> </Card.Text>
<Button className="float-right" onClick={(e) => handleClick(e)}>삭제</Button>
</Card.Body> </Card.Body>
</Card> </Card>
</Row> </Row>
......
import React, { useState, useEffect, useRef } from 'react'; import React, { useState, useEffect, useRef } from 'react';
import MainNav from '../Components/MainNav'; import MainNav from '../Components/MainNav';
import SubNav from '../Components/SubNav'; import SubNav from '../Components/SubNav';
import { Card, CardDeck, CardColumns, Container, Row } from 'react-bootstrap'; import { Card, Container, Row } from 'react-bootstrap';
function Home() { function Home() {
......
import React, { useState, useEffect, useRef } from 'react'; import React, { useState, useEffect, useRef } from 'react';
import MainNav from '../Components/MainNav'; import MainNav from '../Components/MainNav';
import SubNav from '../Components/SubNav'; import SubNav from '../Components/SubNav';
import { Row, Col, Form, Card } from 'react-bootstrap';
function Products() { function Products() {
...@@ -8,6 +9,63 @@ function Products() { ...@@ -8,6 +9,63 @@ function Products() {
<div> <div>
<MainNav /> <MainNav />
<SubNav /> <SubNav />
<Row className="justify-content-center mt-5">
<Col md={4}>
<img src="https://img.sonyunara.com/files/goods/65976/1601953605_0.jpg" style={{ objectFit: "contain", width: "100%" }} />
</Col>
<Col md={4} className="align-middle">
<Form>
<Form.Group>
<Form.Label>옵션</Form.Label>
<Form.Control as="select" defaultValue="옵션 선택">
<option>옵션 선택</option>
<option>브릭레드(스트랩포함)</option>
<option>베이지(스트랩포함)</option>
<option>블랙(스트랩포함)</option>
</Form.Control>
</Form.Group>
</Form>
</Col>
</Row>
<Row className="justify-content-center mt-5">
<Col md={8}>
<h3 style={{ borderBottom: "1px solid #91877F", paddingBottom: "5px", marginBottom: "1em" }}>설명</h3>
<div></div>
</Col>
</Row>
<div className="m-5">
<h6 style={{ borderBottom: "1px solid", paddingBottom: "5px", marginBottom: "1em" }}>회원님이 선호할만한 상품 추천</h6>
<Row className="justify-content-space" style={{ objectFit: "contain", width: "100%" }}>
<Col as={Card} style={{ width: "16rem" }}>
<Card.Img variant="top" src="https://img.sonyunara.com/files/goods/67504/1607328307_0.jpg" />
<Card.Body>
<Card.Title>클로타탄원피스</Card.Title>
<Card.Text>구매자 : 30</Card.Text>
</Card.Body>
</Col>
<Col as={Card} style={{ width: "16rem" }}>
<Card.Img variant="top" src="https://img.sonyunara.com/files/goods/67504/1607328307_0.jpg" />
<Card.Body>
<Card.Title>클로타탄원피스</Card.Title>
<Card.Text>구매자 : 30</Card.Text>
</Card.Body>
</Col>
<Col as={Card} style={{ width: "16rem" }}>
<Card.Img variant="top" src="https://img.sonyunara.com/files/goods/67504/1607328307_0.jpg" />
<Card.Body>
<Card.Title>클로타탄원피스</Card.Title>
<Card.Text>구매자 : 30</Card.Text>
</Card.Body>
</Col>
<Col as={Card} style={{ width: "16rem" }}>
<Card.Img variant="top" src="https://img.sonyunara.com/files/goods/67504/1607328307_0.jpg" />
<Card.Body>
<Card.Title>클로타탄원피스</Card.Title>
<Card.Text>구매자 : 30</Card.Text>
</Card.Body>
</Col>
</Row>
</div>
</div> </div>
) )
} }
......
<?xml version="1.0" ?><svg viewBox="0 0 32 32" style="fill:rgba(255,255,255,.5)" xmlns="http://www.w3.org/2000/svg"><defs><style>.cls-1{fill:none;}</style></defs><title/><g data-name="Layer 2" id="Layer_2"><path d="M23.52,29h-15a5.48,5.48,0,0,1-5.31-6.83L6.25,9.76a1,1,0,0,1,1-.76H24a1,1,0,0,1,1,.7l3.78,12.16a5.49,5.49,0,0,1-.83,4.91A5.41,5.41,0,0,1,23.52,29ZM8,11,5.11,22.65A3.5,3.5,0,0,0,8.48,27h15a3.44,3.44,0,0,0,2.79-1.42,3.5,3.5,0,0,0,.53-3.13L23.28,11Z"/><path d="M20,17a1,1,0,0,1-1-1V8a3,3,0,0,0-6,0v8a1,1,0,0,1-2,0V8A5,5,0,0,1,21,8v8A1,1,0,0,1,20,17Z"/></g><g id="frame"><rect class="cls-1" height="32" width="32"/></g></svg> <?xml version="1.0" ?><svg viewBox="0 0 32 32" style="fill: #f8f9fa" xmlns="http://www.w3.org/2000/svg"><defs><style>.cls-1{fill:none;}</style></defs><title/><g data-name="Layer 2" id="Layer_2"><path d="M23.52,29h-15a5.48,5.48,0,0,1-5.31-6.83L6.25,9.76a1,1,0,0,1,1-.76H24a1,1,0,0,1,1,.7l3.78,12.16a5.49,5.49,0,0,1-.83,4.91A5.41,5.41,0,0,1,23.52,29ZM8,11,5.11,22.65A3.5,3.5,0,0,0,8.48,27h15a3.44,3.44,0,0,0,2.79-1.42,3.5,3.5,0,0,0,.53-3.13L23.28,11Z"/><path d="M20,17a1,1,0,0,1-1-1V8a3,3,0,0,0-6,0v8a1,1,0,0,1-2,0V8A5,5,0,0,1,21,8v8A1,1,0,0,1,20,17Z"/></g><g id="frame"><rect class="cls-1" height="32" width="32"/></g></svg>
\ No newline at end of file \ No newline at end of file
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
preserveAspectRatio="xMidYMid meet"> preserveAspectRatio="xMidYMid meet">
<g transform="translate(0.000000,32.000000) scale(0.100000,-0.100000)" <g transform="translate(0.000000,32.000000) scale(0.100000,-0.100000)"
fill="#fff" stroke="none"> fill="#f8f9fa" stroke="none">
<path d="M86 288 c-19 -27 -20 -39 -4 -73 13 -28 52 -35 62 -9 10 26 7 79 -6 <path d="M86 288 c-19 -27 -20 -39 -4 -73 13 -28 52 -35 62 -9 10 26 7 79 -6
92 -18 18 -35 15 -52 -10z m52 -21 c6 -30 -7 -67 -23 -67 -22 0 -38 46 -24 71 92 -18 18 -35 15 -52 -10z m52 -21 c6 -30 -7 -67 -23 -67 -22 0 -38 46 -24 71
12 24 42 21 47 -4z"/> 12 24 42 21 47 -4z"/>
......
...@@ -4,6 +4,7 @@ import { BrowserRouter as Router, Route, Redirect, Switch } from 'react-router-d ...@@ -4,6 +4,7 @@ import { BrowserRouter as Router, Route, Redirect, Switch } from 'react-router-d
import Home from './Pages/Home'; import Home from './Pages/Home';
import Login from './Pages/Login'; import Login from './Pages/Login';
import Signup from './Pages/Signup'; import Signup from './Pages/Signup';
import Product from "./Pages/Products";
import Admin from './Pages/Admin'; import Admin from './Pages/Admin';
import ProductsRegist from './Pages/ProductsRegist'; import ProductsRegist from './Pages/ProductsRegist';
import ShoppingCart from './Pages/ShoppingCart'; import ShoppingCart from './Pages/ShoppingCart';
...@@ -18,6 +19,7 @@ ReactDOM.render( ...@@ -18,6 +19,7 @@ ReactDOM.render(
<Route exact path="/" component={Home} /> <Route exact path="/" component={Home} />
<Route path="/login" component={Login} /> <Route path="/login" component={Login} />
<Route path="/signup" component={Signup} /> <Route path="/signup" component={Signup} />
<Route path="/product"component={Product} />
<Route path="/admin" component={Admin} /> <Route path="/admin" component={Admin} />
<Route path="/regist" component={ProductsRegist} /> <Route path="/regist" component={ProductsRegist} />
<Route path="/shoppingcart" component={ShoppingCart} /> <Route path="/shoppingcart" component={ShoppingCart} />
......
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3"><g fill="#61DAFB"><path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/><circle cx="420.9" cy="296.5" r="45.7"/><path d="M520.5 78.1z"/></g></svg> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3"><g fill="#f8f9fa"><path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/><circle cx="420.9" cy="296.5" r="45.7"/><path d="M520.5 78.1z"/></g></svg>
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" ?><svg viewBox="0 0 32 32" style="fill:rgba(255,255,255,.5)" xmlns="http://www.w3.org/2000/svg"><title/><g id="setting"><path d="M19.06,32H12.94A1.94,1.94,0,0,1,11,30.06V28.38c-.19-.08-.38-.15-.57-.24L9.21,29.37a1.92,1.92,0,0,1-2.68,0l-3.9-3.9a1.92,1.92,0,0,1,0-2.68l1.24-1.23c-.09-.19-.16-.38-.24-.57H1.94A1.94,1.94,0,0,1,0,19.06V12.94A1.94,1.94,0,0,1,1.94,11H3.62c.08-.19.15-.38.24-.57L2.63,9.21a1.92,1.92,0,0,1,0-2.68l3.9-3.9a1.92,1.92,0,0,1,2.68,0l1.23,1.24c.19-.09.38-.16.57-.24V1.94A1.94,1.94,0,0,1,12.94,0h6.12A1.94,1.94,0,0,1,21,1.94V3.62l.57.24,1.22-1.23a1.92,1.92,0,0,1,2.68,0l3.9,3.9a1.92,1.92,0,0,1,0,2.68l-1.24,1.23c.09.19.16.38.24.57h1.68A1.94,1.94,0,0,1,32,12.94v6.12A1.94,1.94,0,0,1,30.06,21H28.38c-.08.19-.15.38-.24.57l1.23,1.22a1.92,1.92,0,0,1,0,2.68l-3.9,3.9a1.92,1.92,0,0,1-2.68,0l-1.23-1.24c-.19.09-.38.16-.57.24v1.68A1.94,1.94,0,0,1,19.06,32Zm-9-7,.63.32a10.57,10.57,0,0,0,1.6.66l.67.22V30l5.62-.06-.06-3.05.7-.22A11.36,11.36,0,0,0,20.93,26l.65-.32,2.29,2.2L27.81,24,25.52,21.9l.31-.59a10.72,10.72,0,0,0,.73-1.71l.21-.6H30l-.06-6H26.89l-.2-.62A11.72,11.72,0,0,0,26,10.71l-.31-.61,2.2-2.2L24,4.11,21.9,6.31,21.27,6a10.57,10.57,0,0,0-1.6-.66L19,5.11V2l-6.06.06L13,5.11l-.67.22a10.57,10.57,0,0,0-1.6.66l-.63.32L7.9,4.11,4.11,8l2.2,2.12L6,10.73a10.57,10.57,0,0,0-.66,1.6L5.11,13H2l.06,5.41,3.05-.06.22.67A10.57,10.57,0,0,0,6,20.62l.32.63-2.2,2.2L8,27.24Z"/><path d="M16,24a8,8,0,1,1,8-8A8,8,0,0,1,16,24Zm0-14a6,6,0,1,0,6,6A6,6,0,0,0,16,10Z"/></g></svg> <?xml version="1.0" ?><svg viewBox="0 0 32 32" style="fill: #f8f9fa" xmlns="http://www.w3.org/2000/svg"><title/><g id="setting"><path d="M19.06,32H12.94A1.94,1.94,0,0,1,11,30.06V28.38c-.19-.08-.38-.15-.57-.24L9.21,29.37a1.92,1.92,0,0,1-2.68,0l-3.9-3.9a1.92,1.92,0,0,1,0-2.68l1.24-1.23c-.09-.19-.16-.38-.24-.57H1.94A1.94,1.94,0,0,1,0,19.06V12.94A1.94,1.94,0,0,1,1.94,11H3.62c.08-.19.15-.38.24-.57L2.63,9.21a1.92,1.92,0,0,1,0-2.68l3.9-3.9a1.92,1.92,0,0,1,2.68,0l1.23,1.24c.19-.09.38-.16.57-.24V1.94A1.94,1.94,0,0,1,12.94,0h6.12A1.94,1.94,0,0,1,21,1.94V3.62l.57.24,1.22-1.23a1.92,1.92,0,0,1,2.68,0l3.9,3.9a1.92,1.92,0,0,1,0,2.68l-1.24,1.23c.09.19.16.38.24.57h1.68A1.94,1.94,0,0,1,32,12.94v6.12A1.94,1.94,0,0,1,30.06,21H28.38c-.08.19-.15.38-.24.57l1.23,1.22a1.92,1.92,0,0,1,0,2.68l-3.9,3.9a1.92,1.92,0,0,1-2.68,0l-1.23-1.24c-.19.09-.38.16-.57.24v1.68A1.94,1.94,0,0,1,19.06,32Zm-9-7,.63.32a10.57,10.57,0,0,0,1.6.66l.67.22V30l5.62-.06-.06-3.05.7-.22A11.36,11.36,0,0,0,20.93,26l.65-.32,2.29,2.2L27.81,24,25.52,21.9l.31-.59a10.72,10.72,0,0,0,.73-1.71l.21-.6H30l-.06-6H26.89l-.2-.62A11.72,11.72,0,0,0,26,10.71l-.31-.61,2.2-2.2L24,4.11,21.9,6.31,21.27,6a10.57,10.57,0,0,0-1.6-.66L19,5.11V2l-6.06.06L13,5.11l-.67.22a10.57,10.57,0,0,0-1.6.66l-.63.32L7.9,4.11,4.11,8l2.2,2.12L6,10.73a10.57,10.57,0,0,0-.66,1.6L5.11,13H2l.06,5.41,3.05-.06.22.67A10.57,10.57,0,0,0,6,20.62l.32.63-2.2,2.2L8,27.24Z"/><path d="M16,24a8,8,0,1,1,8-8A8,8,0,0,1,16,24Zm0-14a6,6,0,1,0,6,6A6,6,0,0,0,16,10Z"/></g></svg>
\ No newline at end of file \ No newline at end of file
This diff is collapsed.
node_modules node_modules
package-lock.json
\ No newline at end of file
import express from 'express'
import connectDb from './schemas/index.js'
import userRouter from "./routes/user.routes.js";
connectDb()
// const createError = require('http-errors'); // const createError = require('http-errors');
const express = require('express'); // const express = require('express');
const path = require('path'); // const path = require('path');
// const cookieParser = require('cookie-parser'); // const cookieParser = require('cookie-parser');
// const logger = require('morgan'); // const logger = require('morgan');
const port = 3030; // const port = 3030;
// const indexRouter = require('./routes/index'); // const indexRouter = require('./routes/index');
...@@ -17,29 +24,31 @@ const app = express(); ...@@ -17,29 +24,31 @@ const app = express();
// app.use(logger('dev')); // app.use(logger('dev'));
app.use(express.json()); app.use(express.json());
app.use(express.urlencoded({ extended: false })); // app.use(express.urlencoded({ extended: false }));
// app.use(cookieParser(process.env.JWT_SECRET)); // app.use(cookieParser(process.env.JWT_SECRET));
// app.use(express.static(path.join(__dirname, 'public'))); // app.use(express.static(path.join(__dirname, 'public')));
// app.use('/', indexRouter); // app.use('/', indexRouter);
app.listen(port, () => console.log(port)); // app.listen(port, () => console.log(port));
// app.listen(3001, () => console.log(port)); app.listen(3001, () => console.log('Listenning'));
app.use(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) {
next(createError(404)); // next(createError(404));
}); // });
// error handler // error handler
app.use(function(err, req, res, next) { // app.use(function(err, req, res, next) {
// set locals, only providing error in development // set locals, only providing error in development
res.locals.message = err.message; // res.locals.message = err.message;
// res.locals.error = req.app.get('env') === 'development' ? err : {}; // res.locals.error = req.app.get('env') === 'development' ? err : {};
// render the error page // render the error page
res.status(err.status || 500); // res.status(err.status || 500);
// res.render('error'); // res.render('error');
}); // });
module.exports = app; // module.exports = app;
\ No newline at end of file \ No newline at end of file
const config = {
env: process.env.NODEENV || 'development',
port: process.env.PORT || 3001,
jwtSecret: process.env.JWT_SECRET || 'My_Secret_Key',
mongoDbUri: process.env.MONGEDB_URI || 'mongodb://localhost/'
}
export default config
\ No newline at end of file
import User from "../models/User.js";
const signup = async (req, res) => {
const { name, email, password } = req.body
try {
const newUser = await new User ({
name,
email,
password
}).save()
console.log(newUser)
res.json(newUser)
} catch (error) {
console.log(error)
res.status(500).send('죄송합니다. 다시 입력해 주십시오.')
}
}
const hello = (req, res) => {
res.send('Hello from users contriller')
}
export default { signup, hello }
\ No newline at end of file
import mongoose from "mongoose";
const { String } = mongoose.Schema.Types
const UserSchema = new mongoose.Schema({
name: {
type: String,
required: true,
},
email: {
type: String,
required: true,
unique: true,
},
password: {
type: String,
required: true,
select: true,
},
role: {
type: String,
required: true,
default: 'user',
enum: ['user', 'admin', 'root']
}
}, {
timestamps: true
})
export default mongoose.models.User || mongoose.model('User', UserSchema)
\ No newline at end of file
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
"name": "server", "name": "server",
"version": "1.0.0", "version": "1.0.0",
"description": "", "description": "",
"type": "module",
"main": "app.js", "main": "app.js",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
......
import express from "express";
import userCtrl from '../controllers/user.controller.js';
const router = express.Router()
router.route('/api/users/signup')
.post(userCtrl.signup)
.get(userCtrl.hello)
export default router
\ No newline at end of file
import mongoose from "mongoose";
import config from '../config.js';
const connection = {}
async function connectDb() {
// if (connection.isConnection) {
// return
// }
const db = await mongoose.connect(config.mongoDbUri, {
useNewUrlParser: true,
useUnifiedTopology: true,
useFindAndModify: false,
useCreateIndex: true
})
connection.isConnection = db.connections[0].readyState
}
export default connectDb
\ No newline at end of file
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