Browse Source

getApiRoot 保护

dev
巴林闲侠 2 years ago
parent
commit
73943024c4
  1. 2
      scripts/0.0.1/data/3_init_report_pic_data/index.js
  2. 8
      web/routes/attachment/index.js

2
scripts/0.0.1/data/3_init_report_pic_data/index.js

@ -9,7 +9,7 @@ try {
const qiniu = require('qiniu'); const qiniu = require('qiniu');
const uuidv4 = require('uuid/v4'); const uuidv4 = require('uuid/v4');
// 连接数据库 // 测试环境
// const pool = new Pool({ // const pool = new Pool({
// user: 'FashionAdmin', // user: 'FashionAdmin',
// host: '10.8.30.156', // host: '10.8.30.156',

8
web/routes/attachment/index.js

@ -18,9 +18,13 @@ const ext = {
module.exports = { module.exports = {
entry: function (app, router, opts) { entry: function (app, router, opts) {
const getApiRoot = async function (ctx) { const getApiRoot = async function (ctx) {
try {
const { apiUrl, qndmn } = opts; const { apiUrl, qndmn } = opts;
ctx.status = 200; ctx.status = 200;
ctx.body = { root: apiUrl, qndmn }; ctx.body = { root: apiUrl, qndmn };
} catch (error) {
console.error('getApiRoot', error)
}
}; };
let upload = async function (ctx, next) { let upload = async function (ctx, next) {
@ -84,7 +88,7 @@ module.exports = {
} }
router.get('/api/root', getApiRoot); router.get('/api/root', getApiRoot);
router.post('/_upload/new', upload); // router.post('/_upload/new', upload);
router.delete('/_upload/cleanup', remove); // router.delete('/_upload/cleanup', remove);
} }
}; };

Loading…
Cancel
Save