docs: function emitServer({
    port,
    prompts,
    promptsForRender,
    whenPrompts,
    withoutWhenPrompts,
    templatePath = DEFAULT_TPL_PATH,
    tplData = {
      title: '😊 Dulcet Inquirer'
    }
  }) {
    const string = fs.readFileSync(templatePath).toString()
    const compiled = template(string, { interpolate: /<%=([\s\S]+?)%>/g })
  
    const emitter = new EventEmitter()
    const promptValues = prompts.reduce(function(set, val) {
      set[val.name] = val
      return set
    }, {})
  
    const store = withoutWhenPrompts.reduce(function(set, { name, default: _default }) {
      set[name] = _default
      return set
    }, {})
  
    function getErrorMsg(prompt, value) {
      if (prompt && typeof prompt.validate === 'function') {
        const msg = prompt.validate(value, store)
        if (typeof msg === 'string') {
          return msg
        }
      }
    }
    function getErrors() {
      const errors = {}
      prompts.forEach(function(prompt) {
        const msg = getErrorMsg(prompt, store[prompt.name])
        if (msg) {
          errors[prompt.name] = msg
        }
      })
      return Object.keys(errors).length ? errors : null
    }
  
    const server = app.listen(port, function() {
      emitter.emit('server-started')
    })
    app._server = server
  
    app.get('/', function(req, res) {
      res.type('html')
      res.send(
        compiled(
          Object.assign({}, tplData, {
            prompts: promptsForRender
          })
        )
      )
    })
  
    app.get('/when', function(req, res) {
      const passedList = []
      const failedList = []
      whenPrompts.forEach(function(item) {
        if (item.when(store)) {
          if (!store.hasOwnProperty(item.name)) {
            store[item.name] = item.default
          }
          passedList.push(item)
        } else {
          if (item.name in store) {
            delete store[item.name]
          }
          failedList.push(item)
        }
      })
  
      pass(res, 'when-passed', {
        passed: passedList.map(item => item.name),
        failed: failedList.map(item => item.name)
      })
    })
  
    app.get('/set', function(req, res) {
      const { name, value } = JSON.parse(req.query._)
      const prompt = prompts.find(x => x.name === name)
      if (prompt && typeof prompt.validate === 'function') {
        const msg = getErrorMsg(promptValues[name], value)
        if (msg) {
          store[name] = value
          pass(res, 'errors', { [name]: msg })
        } else {
          store[name] = value
          pass(res, 'validate-passed', name)
        }
        return
      }
      // console.log('set:before', store)
      store[name] = value
      // console.log('set:after', store)
      pass(res, 'passed', name)
    })
  
    // app.get('/transformer', function() {
    //   compiled(prompts)
    // })
  
    app.post('/submit', function(req, res) {
      // const { values } = req.query
      const errors = getErrors()
      if (errors) {
        pass(res, 'errors', errors)
      } else {
        pass(res, 'close', 'Submit succeed!')
  
        emitter.emit('done', store)
      }
      // store = values
    })
    return emitter
  }