Mingyu

Login/signup page

......@@ -12,6 +12,8 @@ var lpgRouter = require('./routes/lpg')
var weatherRouter = require('./routes/weather')
var menuRouter = require('./routes/menu')
var app = express();
var router = express.Router();
// get port
var port = process.env.PORT || 3000;
......@@ -41,6 +43,8 @@ app.use('/lpg',lpgRouter)
app.use('/signup',sign_upRouter); // sign up page route
app.use('/', indexRouter); // main page route
//모든 router 처리가 끝난 후 404 오류 페이지 처리
var errorHandler = expressErrorHandler({
static: {
......
This diff is collapsed. Click to expand it.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<tilte>로그인 테스트</tilte>
</head>
<body>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="" />
<meta name="author" content="" />
<title>Modern Business - Start Bootstrap Template</title>
<!-- Favicon-->
<link rel="icon" type="image/x-icon" href="assets/favicon.ico" />
<!-- Bootstrap icons-->
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css" rel="stylesheet" />
<!-- Core theme CSS (includes Bootstrap)-->
<link href="css/styles.css" rel="stylesheet" />
</head>
<body class="d-flex flex-column">
<main class="flex-shrink-0">
<!-- Navigation-->
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container px-5">
<a class="navbar-brand" href="/">휴게소 정보</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"
data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation"><span
class="navbar-toggler-icon"></span></button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ms-auto mb-2 mb-lg-0">
<li class="nav-item"><a class="nav-link" href="/">Home</a></li>
<li class="nav-item"><a class="nav-link" href="/menu">휴게소 메뉴</a></li>
<li class="nav-item"><a class="nav-link" href="/weather">날씨</a></li>
<li class="nav-item"><a class="nav-link" href="/lpg">LPG</a></li>
<li class="nav-item"><a class="nav-link" href="faq.html">FAQ</a></li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" id="navbarDropdownBlog" href="#" role="button"
data-bs-toggle="dropdown" aria-expanded="false">Blog</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownBlog">
<li><a class="dropdown-item" href="blog-home.html">Blog Home</a></li>
<li><a class="dropdown-item" href="blog-post.html">Blog Post</a></li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" id="navbarDropdownLogin" href="#" role="button"
data-bs-toggle="dropdown" aria-expanded="false">Login</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownLogin">
<li><a class="dropdown-item" href="login.html">Login</a></li>
<li><a class="dropdown-item" href="signup.html">Sign-up</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<!-- Header-->
<header class="py-5">
<div class="container px-5">
<div class="row justify-content-center">
<div class="col-lg-8 col-xxl-6">
<div class="text-center my-5">
<h1>로그인</h1>
<br>
<form method="post" action="/process/login/rest_list">
<form method="post" action="/login/process">
<table>
<tr>
<td><label>아이디</label></td>
......@@ -20,5 +73,34 @@
</table>
<input type="submit" value="전송" name="">
</form>
</body>
</div>
</div>
</div>
</div>
</header>
<!-- About section one-->
</main>
<!-- Footer-->
<footer class="bg-dark py-4 mt-auto">
<div class="container px-5">
<div class="row align-items-center justify-content-between flex-column flex-sm-row">
<div class="col-auto">
<div class="small m-0 text-white">Copyright &copy; Your Website 2022</div>
</div>
<div class="col-auto">
<a class="link-light small" href="#!">Privacy</a>
<span class="text-white mx-1">&middot;</span>
<a class="link-light small" href="#!">Terms</a>
<span class="text-white mx-1">&middot;</span>
<a class="link-light small" href="#!">Contact</a>
</div>
</div>
</div>
</footer>
<!-- Bootstrap core JS-->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
<!-- Core theme JS-->
<script src="js/scripts.js"></script>
</body>
</html>
\ No newline at end of file
......
<!DOCTYPE html>
<html lang="ko">
<head>
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@500&display=swap" rel="stylesheet">
</head>
<body>
<style>
*{
font-family: 'Noto Sans KR', sans-serif;
list-style: none;
text-decoration: none;
border-collapse: collapse;
margin: 0px;
padding: 0px;
}
.headbar{
display:flex;
width:1535px;
height:50px;
margin-top:20px;
}
.title{
margin-left: 200px;
}
.title span{
margin-left: 10px
}
.button {
margin-top: 8px;
margin-left: 600px;;
}
.button span{
margin-left: 20px;
}
.intro{
position:fixed;
width: 1535px;
height:290px;
background-color: #40E0D0;
}
.des{
margin-top:120px;
margin-left: 230px;
}
.bar{
margin-bottom:15px;
}
.icon{
position:fixed;
top: 270px;
margin-left: 910px;
}
.icon span{
border:4px solid white;
border-radius:30%;
padding-top: 20px;
padding-bottom: 20px;
padding-left: 20px;
padding-right: 20px;
margin-left:5px;
}
</style>
<div class="wrap">
<div class="headbar">
<div class ="title">
<span style="font-size: 22px;"><b>✧ 휴게소의 모든 것 ✧</b></span>
<span style="color:#0A9696">Everything Of Rest Area</span>
</div>
<div class = "button">
<span><a href="https://www.naver.com/" style = "color: #0A9696;">Log in</a></span>
<span><a href="https://www.google.co.kr" style = "color: #0A9696;">Sign up</a></span>
</div>
</div>
<div class="intro" style="background: #40E0D0">
<div class="des">
<div class="bar">
<hr size="6" width= "200px" color="white">
</div>
<div style="color:white; font-size: 32px;"><b>당신이 방문할 휴게소의 모든 정보,</b></div>
<div style="color: white; font-size:40px;"><b> 휴게소의 모든 것</b></div>
</div>
<div class="icon">
<span style="color:white; font-size:20px;"><b>날씨</b></span>
<span style="color:white; font-size:20px;"><b>메뉴</b></span>
<span style="color:white; font-size:20px;"><b>LPG</b></span>
</div>
</div>
</div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="" />
<meta name="author" content="" />
<title>Modern Business - Start Bootstrap Template</title>
<!-- Favicon-->
<link rel="icon" type="image/x-icon" href="assets/favicon.ico" />
<!-- Bootstrap icons-->
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css" rel="stylesheet" />
<!-- Core theme CSS (includes Bootstrap)-->
<link href="css/styles.css" rel="stylesheet" />
</head>
<body class="d-flex flex-column">
<main class="flex-shrink-0">
<!-- Navigation-->
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container px-5">
<a class="navbar-brand" href="/">휴게소 정보</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"
data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation"><span
class="navbar-toggler-icon"></span></button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ms-auto mb-2 mb-lg-0">
<li class="nav-item"><a class="nav-link" href="/">Home</a></li>
<li class="nav-item"><a class="nav-link" href="/menu">휴게소 메뉴</a></li>
<li class="nav-item"><a class="nav-link" href="/weather">날씨</a></li>
<li class="nav-item"><a class="nav-link" href="/lpg">LPG</a></li>
<li class="nav-item"><a class="nav-link" href="faq.html">FAQ</a></li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" id="navbarDropdownBlog" href="#" role="button"
data-bs-toggle="dropdown" aria-expanded="false">Blog</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownBlog">
<li><a class="dropdown-item" href="blog-home.html">Blog Home</a></li>
<li><a class="dropdown-item" href="blog-post.html">Blog Post</a></li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" id="navbarDropdownLogin" href="#" role="button"
data-bs-toggle="dropdown" aria-expanded="false">Login</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownLogin">
<li><a class="dropdown-item" href="login.html">Login</a></li>
<li><a class="dropdown-item" href="signup.html">Sign-up</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<!-- Header-->
<header class="py-5">
<div class="container px-5">
<div class="row justify-content-center">
<div class="col-lg-8 col-xxl-6">
<div class="text-center my-5">
<h1>로그인</h1>
<br>
<form method="post" action="/login/process">
<table>
<tr>
<td><label>이름</label></td>
<td><input type="text" name="name"></td>
</tr>
<tr>
<td><label>아이디</label></td>
<td><input type="text" name="id"></td>
</tr>
<tr>
<td><label>비밀번호</label></td>
<td><input type="text" name="password"></td>
</tr>
</table>
<input type="submit" value="전송" name="">
</form>
</div>
</div>
</div>
</div>
</header>
<!-- About section one-->
</main>
<!-- Footer-->
<footer class="bg-dark py-4 mt-auto">
<div class="container px-5">
<div class="row align-items-center justify-content-between flex-column flex-sm-row">
<div class="col-auto">
<div class="small m-0 text-white">Copyright &copy; Your Website 2022</div>
</div>
<div class="col-auto">
<a class="link-light small" href="#!">Privacy</a>
<span class="text-white mx-1">&middot;</span>
<a class="link-light small" href="#!">Terms</a>
<span class="text-white mx-1">&middot;</span>
<a class="link-light small" href="#!">Contact</a>
</div>
</div>
</div>
</footer>
<!-- Bootstrap core JS-->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
<!-- Core theme JS-->
<script src="js/scripts.js"></script>
</body>
</html>
\ No newline at end of file
var express = require('express')
var router = express.Router()
/*
//라우터 객체 참조
var router = express.Router();
//라우팅 함수 등록
router.route('/process/login/:name').post(function (req, res) {
console.log('/process/login/:name 처리함');
var paramName = req.params.name;
router.get('/',function(req,res){
res.render('login.html')
});
router.post('/process', function(req, res) {
console.log('/process/login 처리함');
var paramId = req.body.id || req.query.id;
var paramPassword = req.body.password || req.query.password;
......@@ -17,17 +16,10 @@ router.route('/process/login/:name').post(function (req, res) {
res.writeHead('200', { 'Content-Type': 'text/html;charset=utf8' });
res.write('<h1>Result form Express Server</h1>');
res.write('<div><p>Param name : ' + paramName + '</p></div>');
res.write('<div><p>Param id : ' + paramId + '</p></div>');
res.write('<div><p>Param password : ' + paramPassword + '</p></div>');
res.write("<br><br><a href ='/login3.html'>로그인 페이지로 돌아가기</a>");
res.write("<br><br><a href ='/login.html'>로그인 페이지로 돌아가기</a>");
res.end();
});
*/
router.get('/',function(req,res){
res.render('login.html')
})
module.exports = router
\ No newline at end of file
......
......@@ -2,7 +2,25 @@ var express = require('express')
var router = express.Router()
router.get('/',function(req,res){
res.render('sign_up.html')
})
res.render('views/signup.html')
});
router.post('/process', function(req, res) {
console.log('/signup/process 처리함');
var paramName = req.body.name || req.query.name;
var paramId = req.body.id || req.query.id;
var paramPassword = req.body.password || req.query.password;
//GET, POST 모두 고려해서 둘 다 검사
res.writeHead('200', { 'Content-Type': 'text/html;charset=utf8' });
res.write('<h1>Result form Express Server</h1>');
res.write('<div><p>Param name : ' + paramName + '</p></div>');
res.write('<div><p>Param id : ' + paramId + '</p></div>');
res.write('<div><p>Param password : ' + paramPassword + '</p></div>');
res.write("<br><br><a href ='/login.html'>로그인 페이지로 돌아가기</a>");
res.end();
});
module.exports = router
\ No newline at end of file
......
......@@ -35,10 +35,10 @@
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" id="navbarDropdownPortfolio" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">Portfolio</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownPortfolio">
<li><a class="dropdown-item" href="portfolio-overview.html">Portfolio Overview</a></li>
<li><a class="dropdown-item" href="portfolio-item.html">Portfolio Item</a></li>
<a class="nav-link dropdown-toggle" id="navbarDropdownLogin" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">Login</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownLogin">
<li><a class="dropdown-item" href="login.html">Login</a></li>
<li><a class="dropdown-item" href="signup.html">Sign-up</a></li>
</ul>
</li>
</ul>
......
......@@ -35,10 +35,10 @@
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" id="navbarDropdownPortfolio" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">Portfolio</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownPortfolio">
<li><a class="dropdown-item" href="portfolio-overview.html">Portfolio Overview</a></li>
<li><a class="dropdown-item" href="portfolio-item.html">Portfolio Item</a></li>
<a class="nav-link dropdown-toggle" id="navbarDropdownLogin" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">Login</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownLogin">
<li><a class="dropdown-item" href="login.html">Login</a></li>
<li><a class="dropdown-item" href="signup.html">Sign-up</a></li>
</ul>
</li>
</ul>
......
......@@ -35,10 +35,10 @@
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" id="navbarDropdownPortfolio" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">Portfolio</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownPortfolio">
<li><a class="dropdown-item" href="portfolio-overview.html">Portfolio Overview</a></li>
<li><a class="dropdown-item" href="portfolio-item.html">Portfolio Item</a></li>
<a class="nav-link dropdown-toggle" id="navbarDropdownLogin" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">Login</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownLogin">
<li><a class="dropdown-item" href="login.html">Login</a></li>
<li><a class="dropdown-item" href="signup.html">Sign-up</a></li>
</ul>
</li>
</ul>
......
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<tilte>로그인 테스트</tilte>
</head>
<body>
<h1>로그인</h1>
<br>
<form method="post" action="/process/login/rest_list">
<table>
<tr>
<td><label>아이디</label></td>
<td><input type="text" name="id"></td>
</tr>
<tr>
<td><label>비밀번호</label></td>
<td><input type="text" name="password"></td>
</tr>
</table>
<input type="submit" value="전송" name="">
</form>
</body>
</html>
\ No newline at end of file
......@@ -35,10 +35,10 @@
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" id="navbarDropdownPortfolio" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">Portfolio</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownPortfolio">
<li><a class="dropdown-item" href="portfolio-overview.html">Portfolio Overview</a></li>
<li><a class="dropdown-item" href="portfolio-item.html">Portfolio Item</a></li>
<a class="nav-link dropdown-toggle" id="navbarDropdownLogin" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">Login</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownLogin">
<li><a class="dropdown-item" href="login.html">Login</a></li>
<li><a class="dropdown-item" href="signup.html">Sign-up</a></li>
</ul>
</li>
</ul>
......
......@@ -35,10 +35,10 @@
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" id="navbarDropdownPortfolio" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">Portfolio</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownPortfolio">
<li><a class="dropdown-item" href="portfolio-overview.html">Portfolio Overview</a></li>
<li><a class="dropdown-item" href="portfolio-item.html">Portfolio Item</a></li>
<a class="nav-link dropdown-toggle" id="navbarDropdownLogin" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">Login</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownLogin">
<li><a class="dropdown-item" href="login.html">Login</a></li>
<li><a class="dropdown-item" href="signup.html">Sign-up</a></li>
</ul>
</li>
</ul>
......
......@@ -35,10 +35,10 @@
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" id="navbarDropdownPortfolio" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">Portfolio</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownPortfolio">
<li><a class="dropdown-item" href="portfolio-overview.html">Portfolio Overview</a></li>
<li><a class="dropdown-item" href="portfolio-item.html">Portfolio Item</a></li>
<a class="nav-link dropdown-toggle" id="navbarDropdownLogin" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">Login</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownLogin">
<li><a class="dropdown-item" href="login.html">Login</a></li>
<li><a class="dropdown-item" href="signup.html">Sign-up</a></li>
</ul>
</li>
</ul>
......