bia
Version:
a tool for download git repository
46 lines (42 loc) • 1.03 kB
JavaScript
/*
* @Author: hzxulin@yeah.net
* @Date: 2018-12-19 17:47:10
* @Last Modified by: hzxulin@yeah.net
* @Last Modified time: 2018-12-19 17:58:05
*/
const inquirer = require('inquirer')
/**
* 获取是否需要支持cors跨域
*/
const getCorsConfig = () => {
return new Promise((resolve, reject) => {
const question = [{
type: 'list',
name: 'corsFlag',
message: '请选择接口请求是否需要支持跨域',
choices: [
{
name: '是',
value: true,
},
{
name: '否',
value: false,
},
],
filter: (val) => {
return val
},
}]
try {
inquirer.prompt(question).then((answer) => {
resolve(answer.corsFlag)
})
} catch (err) {
reject(err)
}
})
}
module.exports = {
getCorsConfig,
}