【问题标题】:How to disable /files endpoints on parse-server如何在解析服务器上禁用 /files 端点
【发布时间】:2017-06-23 22:11:21
【问题描述】:

使用新推出的 Parse 服务器社区版本 (https://github.com/parse-community/parse-server) 似乎没有配置选项来禁用允许文件上传和托管的 /files 端点。我非常想禁用此功能,并且 Cloud Code 服务器端挂钩不是一个好的选择(解析仪表板目前不支持,以及其他问题)。禁用这些端点的最佳方法是什么?

【问题讨论】:

    标签: parse-server parse-dashboard


    【解决方案1】:

    使用一些中间件对我有用。将此添加到您的解析应用配置中:

    {
      "middleware": "disableFilesMiddleware",
    }
    

    然后为您的中间件模块 disableFilesMiddleware.js:

    module.exports = function( req , res , next ){
    
      if( req.path.substring( 0 , 12 ) === '/parse/files' ) {
        res.status(400).send({ code: 119 , message: 'files endpoints are disabled' }); 
        return;
      }
    
      next();
    };
    

    【讨论】:

      猜你喜欢
      • 2017-09-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-01
      相关资源
      最近更新 更多