整数的输入语法无效(错误500)

时间:2017-07-24 15:05:43

标签: angularjs node.js coffeescript

我正在努力解决问题,似乎无法找到解决问题的方法。我已经制作了一部分代码来定位文件并将其从文件夹中删除。 问题是我总是最终得到这个内部500错误:整数删除的输入语法无效

节点JS代码

Theme.delete = (fileName) ->
    new Promise((fulfill, reject) ->
      if process.env.TNU_ROOT_DIRECTORY
        path = process.env.TNU_ROOT_DIRECTORY + '/www/app/datas/data/' + fileName
      else
        path = '././uploads/' + fileName

      fs.unlink path, (err, items) ->
        if err
          reject err
        else
          fulfill items
        return
      return
    )

删除远程方法

Theme.remoteMethod 'delete',
    accepts: [
      { arg: 'fileName', type: 'object', required: true, http: {source: 'path'} }
      { arg: 'req', type: 'object', http: source: 'req' }
      { arg: 'res', type: 'object', http: source: 'res' }
    ]
    returns: [
      arg: 'fileName'
      type: 'object'
    ]
    http:
      verb: 'DELETE'
      path: '/delete/:fileName'

Angular Front Code

$scope.delete = (fileName) ->
      console.log(fileName)
      Theme.delete(fileName).$promise
      .then (response) ->
        $scope.status = fileName + ' Deleted Successfully'
        $scope.fileList = files
      .catch (error) ->
        $scope.status = 'KO: ' + error.data.error.message

HTML / Jade代码

md-subheader.md-no-sticky(ng-show="fileList.length" layout="row" layout-align="center center" style="background-color:#ff5252; color:#000000") Uploaded files
md-list-item.make-scrollable(ng-repeat='item in fileList')
  p
    a(href="")  {{ item }} 
  p Document
  p Success
  md-button.md-icon-button.md-primary.md-hue-0.limitElipsis(ng-click="delete(item)")
    md-icon(md-menu-origin md-svg-icon="trash")

是否可以提示如何前进?任何帮助都将受到高度赞赏。

0 个答案:

没有答案