Toggle navigation
Toggle navigation
This project
Loading...
Sign in
장주현
/
Amazon_Shopping_Helper
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
1
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
장주현
2020-06-05 18:03:23 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
500f2376981f910b2ae3ab4c4ebc0c58292c4204
500f2376
1 parent
f021945c
app.js 에postcode연결
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
224 additions
and
0 deletions
app.js
package-lock.json
postcode.v2.js → postcode.v2.html
views/index.ejs
views/index.js
app.js
View file @
500f237
const
express
=
require
(
'express'
);
const
app
=
express
();
const
PORT
=
process
.
env
.
PORT
||
3000
;
//const indexRoute = require("./routes/index");
app
.
set
(
'views'
,
__dirname
+
'/views'
);
app
.
set
(
'view engine'
,
'ejs'
);
app
.
use
(
express
.
static
(
__dirname
+
'/public'
));
//var postcode = require(postcode.v2.html);
//const fs = require('filesystem')
app
.
get
(
'/'
,
function
(
req
,
res
){
//res.send('hello world');
res
.
render
(
'index'
);
});
//app.use('/', indexRoute);
app
.
listen
(
PORT
,
function
(){
console
.
log
(
'listen'
,
PORT
);
});
\ No newline at end of file
...
...
package-lock.json
View file @
500f237
...
...
@@ -11,11 +11,29 @@
"negotiator"
:
"0.6.2"
}
},
"ansi-styles"
:
{
"version"
:
"3.2.1"
,
"resolved"
:
"https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz"
,
"integrity"
:
"sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA=="
,
"requires"
:
{
"color-convert"
:
"^1.9.0"
}
},
"array-flatten"
:
{
"version"
:
"1.1.1"
,
"resolved"
:
"https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz"
,
"integrity"
:
"sha1-ml9pkFGx5wczKPKgCJaLZOopVdI="
},
"async"
:
{
"version"
:
"0.9.2"
,
"resolved"
:
"https://registry.npmjs.org/async/-/async-0.9.2.tgz"
,
"integrity"
:
"sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0="
},
"balanced-match"
:
{
"version"
:
"1.0.0"
,
"resolved"
:
"https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz"
,
"integrity"
:
"sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
},
"body-parser"
:
{
"version"
:
"1.19.0"
,
"resolved"
:
"https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz"
,
...
...
@@ -33,11 +51,48 @@
"type-is"
:
"~1.6.17"
}
},
"brace-expansion"
:
{
"version"
:
"1.1.11"
,
"resolved"
:
"https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz"
,
"integrity"
:
"sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA=="
,
"requires"
:
{
"balanced-match"
:
"^1.0.0"
,
"concat-map"
:
"0.0.1"
}
},
"bytes"
:
{
"version"
:
"3.1.0"
,
"resolved"
:
"https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz"
,
"integrity"
:
"sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg=="
},
"chalk"
:
{
"version"
:
"2.4.2"
,
"resolved"
:
"https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz"
,
"integrity"
:
"sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ=="
,
"requires"
:
{
"ansi-styles"
:
"^3.2.1"
,
"escape-string-regexp"
:
"^1.0.5"
,
"supports-color"
:
"^5.3.0"
}
},
"color-convert"
:
{
"version"
:
"1.9.3"
,
"resolved"
:
"https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz"
,
"integrity"
:
"sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg=="
,
"requires"
:
{
"color-name"
:
"1.1.3"
}
},
"color-name"
:
{
"version"
:
"1.1.3"
,
"resolved"
:
"https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz"
,
"integrity"
:
"sha1-p9BVi9icQveV3UIyj3QIMcpTvCU="
},
"concat-map"
:
{
"version"
:
"0.0.1"
,
"resolved"
:
"https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz"
,
"integrity"
:
"sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
},
"content-disposition"
:
{
"version"
:
"0.5.3"
,
"resolved"
:
"https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz"
,
...
...
@@ -84,6 +139,14 @@
"resolved"
:
"https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz"
,
"integrity"
:
"sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
},
"ejs"
:
{
"version"
:
"3.1.3"
,
"resolved"
:
"https://registry.npmjs.org/ejs/-/ejs-3.1.3.tgz"
,
"integrity"
:
"sha512-wmtrUGyfSC23GC/B1SMv2ogAUgbQEtDmTIhfqielrG5ExIM9TP4UoYdi90jLF1aTcsWCJNEO0UrgKzP0y3nTSg=="
,
"requires"
:
{
"jake"
:
"^10.6.1"
}
},
"encodeurl"
:
{
"version"
:
"1.0.2"
,
"resolved"
:
"https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz"
,
...
...
@@ -94,6 +157,11 @@
"resolved"
:
"https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz"
,
"integrity"
:
"sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg="
},
"escape-string-regexp"
:
{
"version"
:
"1.0.5"
,
"resolved"
:
"https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz"
,
"integrity"
:
"sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
},
"etag"
:
{
"version"
:
"1.8.1"
,
"resolved"
:
"https://registry.npmjs.org/etag/-/etag-1.8.1.tgz"
,
...
...
@@ -136,6 +204,14 @@
"vary"
:
"~1.1.2"
}
},
"filelist"
:
{
"version"
:
"1.0.1"
,
"resolved"
:
"https://registry.npmjs.org/filelist/-/filelist-1.0.1.tgz"
,
"integrity"
:
"sha512-8zSK6Nu0DQIC08mUC46sWGXi+q3GGpKydAG36k+JDba6VRpkevvOWUW5a/PhShij4+vHT9M+ghgG7eM+a9JDUQ=="
,
"requires"
:
{
"minimatch"
:
"^3.0.4"
}
},
"finalhandler"
:
{
"version"
:
"1.1.2"
,
"resolved"
:
"https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz"
,
...
...
@@ -160,6 +236,11 @@
"resolved"
:
"https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz"
,
"integrity"
:
"sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
},
"has-flag"
:
{
"version"
:
"3.0.0"
,
"resolved"
:
"https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz"
,
"integrity"
:
"sha1-tdRU3CGZriJWmfNGfloH87lVuv0="
},
"http-errors"
:
{
"version"
:
"1.7.2"
,
"resolved"
:
"https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz"
,
...
...
@@ -190,6 +271,17 @@
"resolved"
:
"https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz"
,
"integrity"
:
"sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g=="
},
"jake"
:
{
"version"
:
"10.8.2"
,
"resolved"
:
"https://registry.npmjs.org/jake/-/jake-10.8.2.tgz"
,
"integrity"
:
"sha512-eLpKyrfG3mzvGE2Du8VoPbeSkRry093+tyNjdYaBbJS9v17knImYGNXQCUV0gLxQtF82m3E8iRb/wdSQZLoq7A=="
,
"requires"
:
{
"async"
:
"0.9.x"
,
"chalk"
:
"^2.4.2"
,
"filelist"
:
"^1.0.1"
,
"minimatch"
:
"^3.0.4"
}
},
"media-typer"
:
{
"version"
:
"0.3.0"
,
"resolved"
:
"https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz"
,
...
...
@@ -223,6 +315,14 @@
"mime-db"
:
"1.44.0"
}
},
"minimatch"
:
{
"version"
:
"3.0.4"
,
"resolved"
:
"https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz"
,
"integrity"
:
"sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA=="
,
"requires"
:
{
"brace-expansion"
:
"^1.1.7"
}
},
"ms"
:
{
"version"
:
"2.0.0"
,
"resolved"
:
"https://registry.npmjs.org/ms/-/ms-2.0.0.tgz"
,
...
...
@@ -339,6 +439,14 @@
"resolved"
:
"https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz"
,
"integrity"
:
"sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow="
},
"supports-color"
:
{
"version"
:
"5.5.0"
,
"resolved"
:
"https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz"
,
"integrity"
:
"sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow=="
,
"requires"
:
{
"has-flag"
:
"^3.0.0"
}
},
"toidentifier"
:
{
"version"
:
"1.0.0"
,
"resolved"
:
"https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz"
,
...
...
postcode.v2.
js
→
postcode.v2.
html
View file @
500f237
File moved
views/index.ejs
0 → 100644
View file @
500f237
<input type="text" id="sample3_postcode" placeholder="우편번호">
<input type="button" onclick="sample3_execDaumPostcode()" value="우편번호 찾기"><br>
<input type="text" id="sample3_address" placeholder="주소"><br>
<input type="text" id="sample3_detailAddress" placeholder="상세주소">
<input type="text" id="sample3_extraAddress" placeholder="참고항목">
<div id="wrap" style="display:none;border:1px solid;width:500px;height:300px;margin:5px 0;position:relative">
<img src="//t1.daumcdn.net/postcode/resource/images/close.png" id="btnFoldWrap" style="cursor:pointer;position:absolute;right:0px;top:-1px;z-index:1" onclick="foldDaumPostcode()" alt="접기 버튼">
</div>
<script src="https://t1.daumcdn.net/mapjsapi/bundle/postcode/prod/postcode.v2.js"></script>
<script>
// 우편번호 찾기 찾기 화면을 넣을 element
var element_wrap = document.getElementById('wrap');
function foldDaumPostcode() {
// iframe을 넣은 element를 안보이게 한다.
element_wrap.style.display = 'none';
}
function sample3_execDaumPostcode() {
// 현재 scroll 위치를 저장해놓는다.
var currentScroll = Math.max(document.body.scrollTop, document.documentElement.scrollTop);
new daum.Postcode({
oncomplete: function(data) {
// 검색결과 항목을 클릭했을때 실행할 코드를 작성하는 부분.
// 각 주소의 노출 규칙에 따라 주소를 조합한다.
// 내려오는 변수가 값이 없는 경우엔 공백('')값을 가지므로, 이를 참고하여 분기 한다.
var addr = ''; // 주소 변수
var extraAddr = ''; // 참고항목 변수
//사용자가 선택한 주소 타입에 따라 해당 주소 값을 가져온다.
if (data.userSelectedType === 'R') { // 사용자가 도로명 주소를 선택했을 경우
addr = data.roadAddress;
} else { // 사용자가 지번 주소를 선택했을 경우(J)
addr = data.jibunAddress;
}
// 사용자가 선택한 주소가 도로명 타입일때 참고항목을 조합한다.
if(data.userSelectedType === 'R'){
// 법정동명이 있을 경우 추가한다. (법정리는 제외)
// 법정동의 경우 마지막 문자가 "동/로/가"로 끝난다.
if(data.bname !== '' && /[동|로|가]$/g.test(data.bname)){
extraAddr += data.bname;
}
// 건물명이 있고, 공동주택일 경우 추가한다.
if(data.buildingName !== '' && data.apartment === 'Y'){
extraAddr += (extraAddr !== '' ? ', ' + data.buildingName : data.buildingName);
}
// 표시할 참고항목이 있을 경우, 괄호까지 추가한 최종 문자열을 만든다.
if(extraAddr !== ''){
extraAddr = ' (' + extraAddr + ')';
}
// 조합된 참고항목을 해당 필드에 넣는다.
document.getElementById("sample3_extraAddress").value = extraAddr;
} else {
document.getElementById("sample3_extraAddress").value = '';
}
// 우편번호와 주소 정보를 해당 필드에 넣는다.
document.getElementById('sample3_postcode').value = data.zonecode;
document.getElementById("sample3_address").value = addr;
// 커서를 상세주소 필드로 이동한다.
document.getElementById("sample3_detailAddress").focus();
// iframe을 넣은 element를 안보이게 한다.
// (autoClose:false 기능을 이용한다면, 아래 코드를 제거해야 화면에서 사라지지 않는다.)
element_wrap.style.display = 'none';
// 우편번호 찾기 화면이 보이기 이전으로 scroll 위치를 되돌린다.
document.body.scrollTop = currentScroll;
},
// 우편번호 찾기 화면 크기가 조정되었을때 실행할 코드를 작성하는 부분. iframe을 넣은 element의 높이값을 조정한다.
onresize : function(size) {
element_wrap.style.height = size.height+'px';
},
width : '100%',
height : '100%'
}).embed(element_wrap);
// iframe을 넣은 element를 보이게 한다.
element_wrap.style.display = 'block';
}
</script>
\ No newline at end of file
views/index.js
0 → 100644
View file @
500f237
const
express
=
require
(
'express'
);
const
router
=
express
.
Router
();
router
.
get
(
'/'
,
function
(
req
,
res
){
res
.
render
(
'index'
);
});
module
.
exports
=
router
;
\ No newline at end of file
Please
register
or
login
to post a comment