PUBLICERROR
index.js
var express = require('express')
var app = express()
var Mock = require('mockjs')
var port = 4000
app.use(express.static('public'))
app.get('/user/list.do', function(req,  res) {
  var data = {
    'result': 'success',
    'messages': [],
    'fieldErrors': {},
    'errors': [],
    'data': {
      totalCount: 30,
      pageNo: req.query.pageNo,
      pageSize: req.query.pageSize,
      'listData|10': [{
        id: '@id',
        'name': '@name',
        address: '@county(true)',
        'role': '普通用户'
      }]
    }
  }
  data = JSON.stringify(Mock.mock(data))
  res.end(data)
})
module.exports = app.listen(port, function (err) {
  if (err) {
    console.log(err)
    return
  }
  var uri = 'http://localhost:' + port
  console.log('Listening at ' + uri + '\n')
  // when env is testing, don't need open it
  // if (process.env.NODE_ENV !== 'testing') {
  //   opn(uri)
  // }
})