UNPKG

ts300

Version:

唐诗300首

24 lines (22 loc) 670 B
const axios = require('axios'); const loading = require('loading-cli'); const load = loading({ "text": "Loading", "color": "yellow", "interval": 100, "stream": process.stdout, "frames": ["◰", "◳", "◲", "◱"] }).start() module.exports = function () { return new Promise(function (resolve, reject) { axios.get('https://v1.jinrishici.com/all.json') .then(function (response) { resolve(response.data || {}) load.color = 'green'; load.text = 'OK'; load.succeed() }).catch(function (error) { reject(error) }); }); }