Eunsu486

Add res.render

...@@ -7,8 +7,10 @@ var logger = require('morgan'); ...@@ -7,8 +7,10 @@ var logger = require('morgan');
7 var indexRouter = require('./routes/index'); 7 var indexRouter = require('./routes/index');
8 var usersRouter = require('./routes/users'); 8 var usersRouter = require('./routes/users');
9 var categoryRouter = require('./routes/category'); 9 var categoryRouter = require('./routes/category');
10 +var vendorRounter = require('./routes/vendors');
10 11
11 var app = express(); 12 var app = express();
13 +var bodyParser = require('body-parser');
12 14
13 // view engine setup 15 // view engine setup
14 app.set('views', path.join(__dirname, 'views')); 16 app.set('views', path.join(__dirname, 'views'));
...@@ -23,6 +25,8 @@ app.use(express.static(path.join(__dirname, 'public'))); ...@@ -23,6 +25,8 @@ app.use(express.static(path.join(__dirname, 'public')));
23 app.use('/', indexRouter); 25 app.use('/', indexRouter);
24 app.use('/users', usersRouter); 26 app.use('/users', usersRouter);
25 app.use('/category', categoryRouter); 27 app.use('/category', categoryRouter);
28 +app.use('/vendors/bootstrap', express.static(path.join(__dirname, "./node_modules/bootstrap/dist")));
29 +app.use(bodyParser.urlencoded({ extended: false }));
26 30
27 // catch 404 and forward to error handler 31 // catch 404 and forward to error handler
28 app.use(function (req, res, next) { 32 app.use(function (req, res, next) {
......
...@@ -11,7 +11,6 @@ let user_gu; ...@@ -11,7 +11,6 @@ let user_gu;
11 let user_latitude; 11 let user_latitude;
12 let user_longitude; 12 let user_longitude;
13 let hospital_list = []; 13 let hospital_list = [];
14 -
15 router.get('/hospital', function (req, res) { 14 router.get('/hospital', function (req, res) {
16 //api 15 //api
17 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`; 16 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) { ...@@ -38,9 +37,11 @@ router.get('/hospital', function (req, res) {
38 titles = titles + hospital_list[i].title._text + '\n'; 37 titles = titles + hospital_list[i].title._text + '\n';
39 } 38 }
40 console.log(titles); 39 console.log(titles);
40 + res.render('result', { category: 'hospital', titles: titles, hospital_list: hospital_list });
41 +
41 } 42 }
42 } 43 }
43 - res.send("finish"); 44 +
44 }) 45 })
45 }); 46 });
46 47
......