Eunsu486

Add res.render

......@@ -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) {
......
......@@ -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");
})
});
......