YujeLee

전체적 개편

1 node_modules 1 node_modules
2 dist/* 2 dist/*
3 *.log 3 *.log
4 +
5 +#env file#
6 +.env
...\ No newline at end of file ...\ No newline at end of file
......
1 const express = require('express'); 1 const express = require('express');
2 const path = require('path'); 2 const path = require('path');
3 const app = express(); 3 const app = express();
4 +var bodyparser = require('body-parser');
5 +var url = require('url');
6 +require('dotenv').config();
4 7
5 //화면 별 router 연결, 라우터 호출해서 페이지를 불러오는데 사용함. 8 //화면 별 router 연결, 라우터 호출해서 페이지를 불러오는데 사용함.
6 var mainRouter = require('./routes') //호출시 index.js 실행 (main.js : title 할당하고 main.html 열어줌) 9 var mainRouter = require('./routes') //호출시 index.js 실행 (main.js : title 할당하고 main.html 열어줌)
...@@ -19,11 +22,18 @@ app.use('/', mainRouter); ...@@ -19,11 +22,18 @@ app.use('/', mainRouter);
19 //css, image 등 정적 파일을 public에서 불러옴 -> html과 연결함 22 //css, image 등 정적 파일을 public에서 불러옴 -> html과 연결함
20 app.use(express.static(path.join(__dirname, 'public'))); 23 app.use(express.static(path.join(__dirname, 'public')));
21 24
25 +app.get("/find", function (req, res) {
26 + var urlParsed = url.parse(req.url, true);
27 + var querystring = urlParsed.query;
28 + // 값이 querystring.word 으로 불러와짐 ( 검색 단어) : 제목에서 find만 구현하면됨.
29 + res.send(querystring.word);
30 +});
22 31
23 app.get('/logout', function (req, res) { 32 app.get('/logout', function (req, res) {
24 res.send("Logout success"); 33 res.send("Logout success");
25 }); 34 });
26 35
36 +
27 app.listen(app.get('port'), () => { 37 app.listen(app.get('port'), () => {
28 console.log(`Server is running at ${app.get('port')}`); 38 console.log(`Server is running at ${app.get('port')}`);
29 }); 39 });
......
...@@ -146,6 +146,11 @@ ...@@ -146,6 +146,11 @@
146 "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", 146 "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
147 "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" 147 "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA="
148 }, 148 },
149 + "dotenv": {
150 + "version": "8.2.0",
151 + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz",
152 + "integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw=="
153 + },
149 "ee-first": { 154 "ee-first": {
150 "version": "1.1.1", 155 "version": "1.1.1",
151 "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", 156 "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
14 "author": "Hyoseob Song", 14 "author": "Hyoseob Song",
15 "license": "MIT", 15 "license": "MIT",
16 "dependencies": { 16 "dependencies": {
17 + "body-parser": "^1.19.0",
18 + "dotenv": "^8.2.0",
17 "ejs": "^3.1.5", 19 "ejs": "^3.1.5",
18 "express": "^4.17.1", 20 "express": "^4.17.1",
19 "mysql": "^2.18.1" 21 "mysql": "^2.18.1"
......