controller.js
832 Bytes
var express = require('express');
var app = express();
var fs = require('fs')
var Businfo = require("../models/BusInfo");
app.set('views',__dirname+'/views');
app.set('view engine', 'ejs');
//app.engine('html',require('ejs').renderFile);
app.engine('ejs', require('ejs').renderFile);
exports.mainView = function(req, res) {
res.render("index.ejs")
}//main 화면
exports.timeTable = function(req, res) {
var index = Businfo.data.findIndex(function(e, idx){ return e.BusNum == req.query.busNum;});
res.render("timetable.ejs",{busNum:req.query.busNum, remainTime: Businfo.data[index].remainTime, ETD_min_H: Businfo.data[index].ETD_min_H,
ETD_min_m: Businfo.data[index].ETD_min_M, ETD_max_H: Businfo.data[index].ETD_max_H, ETD_max_m: Businfo.data[index].ETD_max_M });
} //timeTable 화면 ejs 변수 렌더링