我是Express的新手,并且具有以下功能:
function diffSummary(o1, o2) {
res = (o1.sample_id === o2.sample_id) && (o1.v_id === o2.v_id) && (o1.type === o2.type) && (o1.sf === o2.sf) && (o1.ef === o2.ef) && (o1.breakpoint1 === o2.breakpoint1) && (o1.breakpoint2 === o2.breakpoint2);
res1 = (o1.sge === o2.sge) && (o1.ege === o2.ege) && (o1.som === o2.som) && (o1.wgs === o2.wgs) && (o1.inframe === o2.inframe) && (o1.platform === o2.platform);
res2 = (o1.rnaconf === o2.rnaconf) && (o1.reportable === o2.reportable) && (o1.targetable === o2.targetable) && (o1.path === o2.path) && (o1.evidence === o2.evidence) && (o1.comments === o2.comments) && (o1.summary !== o2.summary);
if(res && res1 && res2) {
return true;
} else {
return false;
}
}
function isEqual(o1, o2) {
res = (o1.sample_id === o2.sample_id) && (o1.v_id === o2.v_id) && (o1.type === o2.type) && (o1.sf === o2.sf) && (o1.ef === o2.ef) && (o1.breakpoint1 === o2.breakpoint1) && (o1.breakpoint2 === o2.breakpoint2);
res1 = (o1.sge === o2.sge) && (o1.ege === o2.ege) && (o1.som === o2.som) && (o1.wgs === o2.wgs) && (o1.inframe === o2.inframe) && (o1.platform === o2.platform);
res2 = (o1.rnaconf === o2.rnaconf) && (o1.reportable === o2.reportable) && (o1.targetable === o2.targetable) && (o1.path === o2.path) && (o1.evidence === o2.evidence) && (o1.comments === o2.comments) && (o1.summary === o2.summary);
if(res && res1 && res2) {
return true;
} else {
return false;
}
}
我有一个server.js
文件,我正在通过该文件传递要在EJS模板中呈现的数据。但是,我不确定将这些功能传递给EJS模板的最佳方法是什么。我读过其他问题,在名为app.locals
的文件中使用app.js
。但是,如果确实在app.js
文件中定义了函数,如何将其包含在server.js
文件中,以便可以将其传递给模板?任何见解都会受到赞赏。