sjy-ecos/routes/data.js

24 lines
579 B
JavaScript

var express = require('express');
var Promise = require('bluebird');
var router = express.Router();
var models_eco_v1 = require('../model/sjy_eco_v1.js');
router.get('/', function (req, res, next) {
Promise.all([
models_eco_v1.getTop10Metadata(),
models_eco_v1.getLast10Metadata()
]).then(function(results) {
res.render('data', {
metadatas: results[0],
latestMetadatas: results[1],
page_title: 'data'
});
}).catch(function(err) {
console.error(err);
});
});
module.exports = router;