Toggle navigation
Toggle navigation
This project
Loading...
Sign in
임태민
/
Mapmory
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
임태민
2021-05-13 00:23:30 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c7797433b82253d1c107a44e3aa4743ca5bac681
c7797433
1 parent
33397edc
Update app.js
On Construction...
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
97 additions
and
4 deletions
Mapmory/app.js
Mapmory/views/index.html
Mapmory/views/login.html
Mapmory/views/register.html
Mapmory/app.js
View file @
c779743
...
...
@@ -2,9 +2,19 @@ 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
(
'views'
,
__dirname
+
'/views'
);
app
.
set
(
'view engine'
,
'ejs'
);
app
.
set
(
'views'
,
__dirname
+
'/views'
);
app
.
engine
(
'html'
,
require
(
'ejs'
).
renderFile
);
app
.
use
(
express
.
static
(
'public'
));
...
...
@@ -18,14 +28,19 @@ app.use(session({
saveUninitialized
:
false
,
}));
//Home
//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 page
"
);
res
.
send
(
"
login.html
"
);
})
//logout
...
...
@@ -34,7 +49,24 @@ app.put('/logout',function(req,res){
})
//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'
);
})
...
...
Mapmory/views/index.html
View file @
c779743
...
...
@@ -45,7 +45,7 @@
text-align
:
center
;
display
:
inline-block
;
font-size
:
1.25rem
;
margin
:
1
0px
;
margin
:
2
0px
;
cursor
:
pointer
;
border-radius
:
10px
;
}
...
...
Mapmory/views/login.html
0 → 100644
View file @
c779743
<!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
Mapmory/views/register.html
0 → 100644
View file @
c779743
<!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
Please
register
or
login
to post a comment