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-24 23:49:40 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
49d616e79b37490ed0cd195f37edb00ccad99b9b
49d616e7
1 parent
cab633a3
post from index.ejs
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
6 deletions
app.js
views/index.ejs
app.js
View file @
49d616e
const
express
=
require
(
'express'
);
const
request
=
require
(
'request'
);
const
fs
=
require
(
'fs'
);
const
bodyParser
=
require
(
'body-parser'
);
const
app
=
express
();
const
PAPAGO_URL
=
'https://openapi.naver.com/v1/papago/n2mt'
const
client_id
=
'cIZBOTfISMHEyygh_NHp'
;
const
client_secret
=
'8D32UNGgYp'
;
const
PAPAGO_ID
=
'cIZBOTfISMHEyygh_NHp'
;
const
PAPAGO_SECRET
=
'8D32UNGgYp'
;
const
PORT
=
process
.
env
.
PORT
||
3000
;
//const indexRoute = require("./routes/index");
app
.
use
(
bodyParser
.
urlencoded
({
extended
:
true
}));
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')
var
addressK
,
addressE
;
var
detailaddressK
,
detailaddressE
;
var
extraaddressK
,
extraaddressE
;
var
zipcode
;
app
.
get
(
'/'
,
function
(
req
,
res
){
//res.send('hello world');
...
...
@@ -20,8 +26,31 @@ app.use(express.static(__dirname + '/public'));
});
app
.
get
(
'/'
,
function
(
req
,
res
){
res
.
render
(
'index'
);
});
//app.use('/', indexRoute);
app
.
post
(
'/'
,
function
(
req
,
res
){
console
.
log
(
req
.
body
);
zipcode
=
req
.
body
.
zipcode
;
addressK
=
req
.
body
.
addressK
;
detailaddressK
=
req
.
body
.
detailaddressK
;
extraaddressK
=
req
.
body
.
extraaddressK
;
console
.
log
(
addressK
);
addressE
=
trans
(
addressK
,
detailaddressE
);
//trans(detailaddressK, detailaddressE);
//trans(extraaddressK, extraaddressE);
setTimeout
(
function
(){
console
.
log
(
"set: "
+
detailaddressE
)},
500
);
console
.
log
(
"address: "
+
addressE
);
console
.
log
(
"detail: "
+
detailaddressE
);
});
app
.
listen
(
PORT
,
function
(){
console
.
log
(
'listen'
,
PORT
);
});
...
...
@@ -41,6 +70,8 @@ function trans(message, totrans){
if
(
!
error
&&
response
.
statusCode
==
200
)
{
console
.
log
(
body
.
message
);
totrans
=
body
.
message
.
result
.
translatedText
;
return
totrans
;
}
});
};
\ No newline at end of file
...
...
views/index.ejs
View file @
49d616e
<form>
<form
action="" method="POST"
>
<input type="text" name="zipcode" id="sample3_postcode" placeholder="우편번호">
<input type="button" onclick="sample3_execDaumPostcode()" value="우편번호 찾기"><br>
<input type="text" name="addressK" id="sample3_address" placeholder="주소"><br>
...
...
@@ -8,8 +8,8 @@
<input type="text" name="extraaddressK" id="sample3_extraAddress" placeholder="참고항목">
<p> 사용할 해외 쇼핑몰 선택 후 변환</p>
<input type="radio"
id="selshop"
name="os" value="amazon" checked="checked">Amazon
<input type="radio"
id="selshop"
name="os" value="ebay">Ebay
<input type="radio" name="os" value="amazon" checked="checked">Amazon
<input type="radio" name="os" value="ebay">Ebay
<input type="submit" value="주소 변환">
</form>
<p> 사용할 해외 쇼핑몰 선택 후 변환</p>
...
...
Please
register
or
login
to post a comment