var express = require('express'); var router = express.Router(); var Mock = require("mockjs") var moment = require('moment') var util=require('../../public/javascripts/util') //获取主页信息 router.get('/main',function(req, res, next) { var data=Mock.mock({ code:200, message:'获取主页信息成功', result:'OK', body:{ ip:Mock.Random.ip(), 'time|3600-36000':0, lastLoginTime:function (){ return moment(Date.now()-this.time*1000).format(util.dateFormat) } } }) return res.json(data) }) module.exports=router