Showing
8 changed files
with
0 additions
and
263 deletions
Mapmory/app.js
deleted
100644 → 0
1 | -const express = require('express'); | ||
2 | -const bodyParser = require('body-parser'); | ||
3 | -const session = require('express-session'); | ||
4 | -const app = express(); | ||
5 | -const mySql = require('mysql'); | ||
6 | - | ||
7 | -const pool = mySql.createPool({ | ||
8 | - connectionLimit: 10, | ||
9 | - host: 'localhost', | ||
10 | - user: 'root', | ||
11 | - password: 'root', | ||
12 | - database: 'mapmory', | ||
13 | - debug: false | ||
14 | -}); | ||
15 | - | ||
16 | -app.set('view engine', 'ejs'); | ||
17 | -app.set('views', __dirname + '/views'); | ||
18 | -app.engine('html', require('ejs').renderFile); | ||
19 | -app.use(express.static('public')); | ||
20 | - | ||
21 | - | ||
22 | -app.use(bodyParser.json()); | ||
23 | - | ||
24 | -app.use(session({ | ||
25 | - secret: 'keyboard cat', | ||
26 | - cookie: { maxAge: 60000 }, | ||
27 | - resave: false, | ||
28 | - saveUninitialized: false, | ||
29 | - })); | ||
30 | - | ||
31 | -//Home page | ||
32 | -app.get('/', function(req,res){ | ||
33 | - res.render("index.html"); | ||
34 | -}) | ||
35 | - | ||
36 | -//Login page | ||
37 | -app.get('/login', function(req,res){ | ||
38 | - res.render("login.html"); | ||
39 | -}) | ||
40 | - | ||
41 | -//login | ||
42 | -app.put('/login',function(req,res){ | ||
43 | - res.send("login.html"); | ||
44 | -}) | ||
45 | - | ||
46 | -//logout | ||
47 | -app.put('/logout',function(req,res){ | ||
48 | - res.send("Logout page"); | ||
49 | -}) | ||
50 | - | ||
51 | -//register | ||
52 | - | ||
53 | -app.get('/register', function(req,res){ | ||
54 | - res.send("register.html"); | ||
55 | -}) | ||
56 | - | ||
57 | -app.post('/register',function(req,res){ | ||
58 | - console.log('/register 호출됨'); | ||
59 | - | ||
60 | - var user = { | ||
61 | - 'ID': req.body.id, | ||
62 | - 'PWD': req.body.pwd, | ||
63 | - 'NAME': req.body.name | ||
64 | - } | ||
65 | - console.log('ID: ' + user.id + ', PWD: ' + user.PWD + ', NAME: ' + user.NAME); | ||
66 | - | ||
67 | - | ||
68 | - | ||
69 | - //connection.query('INSERT INTO USER SET ?', user, function(error, results, fields)) | ||
70 | - res.send('Register page'); | ||
71 | -}) | ||
72 | - | ||
73 | -//Mapmain | ||
74 | -app.get('/Mapmain',function(req,res){ | ||
75 | - res.send('Mapmain page'); | ||
76 | -}) | ||
77 | - | ||
78 | -//Read post | ||
79 | -app.get('/Mapmain/posts/:postId',function(req,res){ | ||
80 | - var postId = req.params.postId; | ||
81 | - res.send("Mapmain post page " + postId); | ||
82 | -}) | ||
83 | - | ||
84 | -//Create post | ||
85 | -app.post('/Mapmain/posts',function(req,res){ | ||
86 | - res.send("Mapmain create page"); | ||
87 | -}) | ||
88 | - | ||
89 | -//Update post | ||
90 | -app.put('/Mapmain/posts/:postId',function(req,res){ | ||
91 | - var postId = req.params.postId; | ||
92 | - res.send("Mapmain update page " + postId); | ||
93 | -}) | ||
94 | - | ||
95 | -//Delete post | ||
96 | -app.delete('/Mapmain/posts/:postId',function(req,res){ | ||
97 | - var postId = req.params.postId; | ||
98 | - res.send("Mapmain delete page " + postId); | ||
99 | -}) | ||
100 | -//Mapmain/category/:_category | ||
101 | -//Mapmain/post/:_pk | ||
102 | - | ||
103 | -app.listen(3000, ()=> console.log('Example app listening on port 3000!')); | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
Mapmory/package-lock.json
deleted
100644 → 0
This diff is collapsed. Click to expand it.
Mapmory/package.json
deleted
100644 → 0
1 | -{ | ||
2 | - "name": "Mapmory", | ||
3 | - "version": "1.0.0", | ||
4 | - "description": "", | ||
5 | - "main": "app.js", | ||
6 | - "scripts": { | ||
7 | - "test": "echo \"Error: no test specified\" && exit 1" | ||
8 | - }, | ||
9 | - "author": "", | ||
10 | - "license": "ISC", | ||
11 | - "dependencies": { | ||
12 | - "body-parser": "^1.19.0", | ||
13 | - "ejs": "^3.1.6", | ||
14 | - "express": "^4.17.1", | ||
15 | - "express-session": "^1.17.1", | ||
16 | - "mysql": "^2.18.1", | ||
17 | - "package.json": "^2.0.1" | ||
18 | - } | ||
19 | -} |
1.74 MB
1.61 MB
Mapmory/views/index.html
deleted
100644 → 0
1 | -<!DOCTYPE html> | ||
2 | -<html leng="en"> | ||
3 | - <title></title> | ||
4 | - <meta charset = "UTF-8"> | ||
5 | - <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" /> | ||
6 | - <meta name="description" content="" /> | ||
7 | - <meta name="author" content="" /> | ||
8 | - <title>Mapmory</title> | ||
9 | - | ||
10 | - <link rel="preconnect" href="https://fonts.gstatic.com"> | ||
11 | - <link href="https://fonts.googleapis.com/css2?family=PT+Serif:ital@1&display=swap" rel="stylesheet"> | ||
12 | - | ||
13 | - <style> | ||
14 | - body,html{ | ||
15 | - margin: 0; | ||
16 | - padding: 0; | ||
17 | - height: 100%; | ||
18 | - } | ||
19 | - .img{ | ||
20 | - border: 0; | ||
21 | - padding: 0; | ||
22 | - background-image: url('assets/img/bg-callout.jpg'); | ||
23 | - background-size: cover; | ||
24 | - min-height: 100%; | ||
25 | - background-size: cover; | ||
26 | - background-position: center; | ||
27 | - } | ||
28 | - | ||
29 | - .img .content{ | ||
30 | - position: absolute; | ||
31 | - top: 40%; | ||
32 | - left: 50%; | ||
33 | - font-size: 1rem; | ||
34 | - transform: translate(-50%, -50%); | ||
35 | - font-family: 'PT Serif', serif; | ||
36 | - text-align: center; | ||
37 | - } | ||
38 | - | ||
39 | - a { | ||
40 | - width: 100px; | ||
41 | - background-color:olive; | ||
42 | - border: none; | ||
43 | - color:#fff; | ||
44 | - padding:15px 0; | ||
45 | - text-align: center; | ||
46 | - display: inline-block; | ||
47 | - font-size: 1.25rem; | ||
48 | - margin:20px; | ||
49 | - cursor:pointer; | ||
50 | - border-radius:10px; | ||
51 | - } | ||
52 | - | ||
53 | - | ||
54 | - | ||
55 | - h1{ | ||
56 | - font-size: 5rem; | ||
57 | - padding:0; | ||
58 | - margin:0; | ||
59 | - } | ||
60 | - | ||
61 | - h3{ | ||
62 | - font-size: 2.5rem; | ||
63 | - padding:0; | ||
64 | - margin:2px; | ||
65 | - } | ||
66 | - </style> | ||
67 | - | ||
68 | - <body> | ||
69 | - <div class="img"> | ||
70 | - <div class="content"> | ||
71 | - <h1>Mapmory</h1> | ||
72 | - <h3><em>Save your reminiscence with place</em></h3> | ||
73 | - <a class="start" href="/login">START</a> | ||
74 | - </div> | ||
75 | - </div> | ||
76 | - </body> | ||
77 | - | ||
78 | - | ||
79 | - | ||
80 | -</html> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
Mapmory/views/login.html
deleted
100644 → 0
1 | -<!DOCTYPE html> | ||
2 | -<html> | ||
3 | - <head> | ||
4 | - <meta charset="UTF-8"> | ||
5 | - <title>Mapmory-Login</title> | ||
6 | - </head> | ||
7 | - <body> | ||
8 | - <h1>Login</h1> | ||
9 | - <form method="put" action="/login"> | ||
10 | - <table> | ||
11 | - <tr> | ||
12 | - <td><label>ID : </label></td> | ||
13 | - <td><input type="text" name="id"></td> | ||
14 | - </tr> | ||
15 | - <tr> | ||
16 | - <td><label>PWD : </label></td> | ||
17 | - <td><input type="text" name="pwd"></td> | ||
18 | - </tr> | ||
19 | - | ||
20 | - <tr> | ||
21 | - <td><input type="submit" value="Login" name=""></td> | ||
22 | - <a class="start" href="/register">Join</a> | ||
23 | - </tr> | ||
24 | - </table> | ||
25 | - </form> | ||
26 | - </body> | ||
27 | -</html> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
Mapmory/views/register.html
deleted
100644 → 0
1 | -<!DOCTYPE html> | ||
2 | -<html> | ||
3 | -<head> | ||
4 | - <meta charset="UTF-8" /> | ||
5 | - <title>Mapmory-Register</title> | ||
6 | -</head> | ||
7 | -<body> | ||
8 | - <h1>Add User</h1> | ||
9 | - <form method="post" action="/register"> | ||
10 | - <table> | ||
11 | - <tr> | ||
12 | - <td><label>ID : </label></td> | ||
13 | - <td><input type="text" name="id"></td> | ||
14 | - </tr> | ||
15 | - <tr> | ||
16 | - <td><label>PWD : </label></td> | ||
17 | - <td><input type="text" name="pwd"></td> | ||
18 | - </tr> | ||
19 | - | ||
20 | - <tr> | ||
21 | - <td><label>NAME : </label></td> | ||
22 | - <td><input type="text" name="name"></td> | ||
23 | - </tr> | ||
24 | - | ||
25 | - <tr> | ||
26 | - <td><input type="submit" value="Submit" name=""></td> | ||
27 | - </tr> | ||
28 | - | ||
29 | - </table> | ||
30 | - | ||
31 | - </form> | ||
32 | - | ||
33 | -</body> | ||
34 | -</html> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or login to post a comment