Toggle navigation
Toggle navigation
This project
Loading...
Sign in
open-source-group1
/
animal-Info
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Eunsu486
2021-05-27 20:02:47 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c0ee679152fd5ffef48bfa1d56328962ddf3038b
c0ee6791
1 parent
feecabaa
Add res.render
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
2 deletions
app.js
routes/category.js
app.js
View file @
c0ee679
...
...
@@ -7,8 +7,10 @@ var logger = require('morgan');
var
indexRouter
=
require
(
'./routes/index'
);
var
usersRouter
=
require
(
'./routes/users'
);
var
categoryRouter
=
require
(
'./routes/category'
);
var
vendorRounter
=
require
(
'./routes/vendors'
);
var
app
=
express
();
var
bodyParser
=
require
(
'body-parser'
);
// view engine setup
app
.
set
(
'views'
,
path
.
join
(
__dirname
,
'views'
));
...
...
@@ -23,6 +25,8 @@ app.use(express.static(path.join(__dirname, 'public')));
app
.
use
(
'/'
,
indexRouter
);
app
.
use
(
'/users'
,
usersRouter
);
app
.
use
(
'/category'
,
categoryRouter
);
app
.
use
(
'/vendors/bootstrap'
,
express
.
static
(
path
.
join
(
__dirname
,
"./node_modules/bootstrap/dist"
)));
app
.
use
(
bodyParser
.
urlencoded
({
extended
:
false
}));
// catch 404 and forward to error handler
app
.
use
(
function
(
req
,
res
,
next
)
{
...
...
routes/category.js
View file @
c0ee679
...
...
@@ -11,7 +11,6 @@ let user_gu;
let
user_latitude
;
let
user_longitude
;
let
hospital_list
=
[];
router
.
get
(
'/hospital'
,
function
(
req
,
res
)
{
//api
let
pet_url
=
`http://api.kcisa.kr/openapi/service/rest/convergence2019/getConver03?serviceKey=
${
ANIMAL_INFO_API_KEY
}
&numOfRows=100&pageNo=1&keyword=%EB%8F%99%EB%AC%BC%EB%B3%91%EC%9B%90&where=%EA%B0%95%EB%B6%81%EA%B5%AC`
;
...
...
@@ -38,9 +37,11 @@ router.get('/hospital', function (req, res) {
titles
=
titles
+
hospital_list
[
i
].
title
.
_text
+
'\n'
;
}
console
.
log
(
titles
);
res
.
render
(
'result'
,
{
category
:
'hospital'
,
titles
:
titles
,
hospital_list
:
hospital_list
});
}
}
res
.
send
(
"finish"
);
})
});
...
...
Please
register
or
login
to post a comment