0

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

4

1 回答 1

0

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

{
  "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-06-23T22:15:24.837 回答