임태민

Delete directory

- 필요없는 파일을 지웠습니다.
const express = require('express');
const bodyParser = require('body-parser');
const session = require('express-session');
const app = express();
const mySql = require('mysql');
const pool = mySql.createPool({
connectionLimit: 10,
host: 'localhost',
user: 'root',
password: 'root',
database: 'mapmory',
debug: false
});
app.set('view engine', 'ejs');
app.set('views', __dirname + '/views');
app.engine('html', require('ejs').renderFile);
app.use(express.static('public'));
app.use(bodyParser.json());
app.use(session({
secret: 'keyboard cat',
cookie: { maxAge: 60000 },
resave: false,
saveUninitialized: false,
}));
//Home page
app.get('/', function(req,res){
res.render("index.html");
})
//Login page
app.get('/login', function(req,res){
res.render("login.html");
})
//login
app.put('/login',function(req,res){
res.send("login.html");
})
//logout
app.put('/logout',function(req,res){
res.send("Logout page");
})
//register
app.get('/register', function(req,res){
res.send("register.html");
})
app.post('/register',function(req,res){
console.log('/register 호출됨');
var user = {
'ID': req.body.id,
'PWD': req.body.pwd,
'NAME': req.body.name
}
console.log('ID: ' + user.id + ', PWD: ' + user.PWD + ', NAME: ' + user.NAME);
//connection.query('INSERT INTO USER SET ?', user, function(error, results, fields))
res.send('Register page');
})
//Mapmain
app.get('/Mapmain',function(req,res){
res.send('Mapmain page');
})
//Read post
app.get('/Mapmain/posts/:postId',function(req,res){
var postId = req.params.postId;
res.send("Mapmain post page " + postId);
})
//Create post
app.post('/Mapmain/posts',function(req,res){
res.send("Mapmain create page");
})
//Update post
app.put('/Mapmain/posts/:postId',function(req,res){
var postId = req.params.postId;
res.send("Mapmain update page " + postId);
})
//Delete post
app.delete('/Mapmain/posts/:postId',function(req,res){
var postId = req.params.postId;
res.send("Mapmain delete page " + postId);
})
//Mapmain/category/:_category
//Mapmain/post/:_pk
app.listen(3000, ()=> console.log('Example app listening on port 3000!'));
\ No newline at end of file
This diff is collapsed. Click to expand it.
{
"name": "Mapmory",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"body-parser": "^1.19.0",
"ejs": "^3.1.6",
"express": "^4.17.1",
"express-session": "^1.17.1",
"mysql": "^2.18.1",
"package.json": "^2.0.1"
}
}
<!DOCTYPE html>
<html leng="en">
<title></title>
<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>Mapmory</title>
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=PT+Serif:ital@1&display=swap" rel="stylesheet">
<style>
body,html{
margin: 0;
padding: 0;
height: 100%;
}
.img{
border: 0;
padding: 0;
background-image: url('assets/img/bg-callout.jpg');
background-size: cover;
min-height: 100%;
background-size: cover;
background-position: center;
}
.img .content{
position: absolute;
top: 40%;
left: 50%;
font-size: 1rem;
transform: translate(-50%, -50%);
font-family: 'PT Serif', serif;
text-align: center;
}
a {
width: 100px;
background-color:olive;
border: none;
color:#fff;
padding:15px 0;
text-align: center;
display: inline-block;
font-size: 1.25rem;
margin:20px;
cursor:pointer;
border-radius:10px;
}
h1{
font-size: 5rem;
padding:0;
margin:0;
}
h3{
font-size: 2.5rem;
padding:0;
margin:2px;
}
</style>
<body>
<div class="img">
<div class="content">
<h1>Mapmory</h1>
<h3><em>Save your reminiscence with place</em></h3>
<a class="start" href="/login">START</a>
</div>
</div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Mapmory-Login</title>
</head>
<body>
<h1>Login</h1>
<form method="put" action="/login">
<table>
<tr>
<td><label>ID : </label></td>
<td><input type="text" name="id"></td>
</tr>
<tr>
<td><label>PWD : </label></td>
<td><input type="text" name="pwd"></td>
</tr>
<tr>
<td><input type="submit" value="Login" name=""></td>
<a class="start" href="/register">Join</a>
</tr>
</table>
</form>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Mapmory-Register</title>
</head>
<body>
<h1>Add User</h1>
<form method="post" action="/register">
<table>
<tr>
<td><label>ID : </label></td>
<td><input type="text" name="id"></td>
</tr>
<tr>
<td><label>PWD : </label></td>
<td><input type="text" name="pwd"></td>
</tr>
<tr>
<td><label>NAME : </label></td>
<td><input type="text" name="name"></td>
</tr>
<tr>
<td><input type="submit" value="Submit" name=""></td>
</tr>
</table>
</form>
</body>
</html>
\ No newline at end of file