Toggle navigation
Toggle navigation
This project
Loading...
Sign in
임연수
/
FaceDetection
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
2
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Ubuntu
2018-12-13 14:47:28 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
61261680b972c2f85a893f392b87f46b43b94124
61261680
1 parent
d5db4369
modify server address for ec2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
9 deletions
app.js
app.js
View file @
6126168
...
...
@@ -3,14 +3,9 @@ var bodyParser= require('body-parser');//post할때 필요
var
multer
=
require
(
'multer'
);
//업로드할 때 필요
var
request
=
require
(
'request'
);
var
http
=
require
(
'http'
);
var
vhost
=
'nodejsapp.local'
;
var
port
=
process
.
env
.
PORT
||
8080
;
var
ip
=
process
.
env
.
IP
||
"localhost"
;
var
app
=
express
();
app
.
set
(
'port'
,
port
);
app
.
locals
.
pretty
=
true
;
app
.
engine
(
'html'
,
require
(
'ejs'
).
renderFile
);
app
.
use
(
express
.
static
(
'public'
));
...
...
@@ -38,7 +33,7 @@ var subscriptionKey = '61650f4a2941462ea2dba74eabefd114';
// subscription keys. For example, if you got your subscription keys from
// westus, replace "westcentralus" in the URL below with "westus".
var
uriBase
=
'https://eastasia.api.cognitive.microsoft.com/face/v1.0/detect'
;
var
imageUrl
=
'http://
localhost
:8080/user/mypic.jpg'
;
var
imageUrl
=
'http://
54.180.159.73
:8080/user/mypic.jpg'
;
// Request parameters.
var
params
=
{
'returnFaceId'
:
'true'
,
...
...
@@ -61,7 +56,7 @@ app.get('/home', function(req,res){
res
.
render
(
'upload'
);
});
app
.
post
(
'/uploads'
,
upload
.
single
(
'userfile'
),
function
(
req
,
res
){
res
.
render
(
"
result
"
)
res
.
render
(
"
facedetection
"
)
console
.
log
(
req
.
file
.
path
)
request
.
post
(
options
,
(
error
,
response
,
body
)
=>
{
if
(
error
)
{
...
...
@@ -74,6 +69,6 @@ app.post('/uploads', upload.single('userfile'),function(req,res){
});
});
var
server
=
http
.
createServer
(
app
).
listen
(
app
.
get
(
'port'
),
function
()
{
console
.
log
(
'Express server listening on port '
+
vhost
+
":"
+
server
.
address
().
port
);
app
.
listen
(
8080
,
function
()
{
console
.
log
(
"connect 8080"
);
});
...
...
Please
register
or
login
to post a comment