const faker = require("faker"); function repeat(fn, times = 10) { let arr = []; while (times--) { arr.push(fn()); } return arr; } module.exports = function(req, res) { res.json({ status: 0, msg: "", data: repeat( () => ({ id: "{{random.number}}", text: "{{address.city}}", progress: Math.round(Math.random() * 100), type: Math.round(Math.random() * 5), boolean: Math.random() > 0.5 ? true : false, // boolean: ['pending', 'success', 'fail', 'queue', 'schedule'][Math.floor(Math.random()*5)], list: repeat( () => ({ title: "{{name.title}}", description: "{{lorem.words}}" }), Math.round(Math.random() * 10) ), audio: "https://news-bos.cdn.bcebos.com/mvideo/%E7%9A%87%E5%90%8E%E5%A4%A7%E9%81%93%E4%B8%9C.aac", carousel: [ { image: "https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=3893101144,2877209892&fm=23&gp=0.jpg" }, { html: '