5

データメソッド DELETE を送信するためだけに、AngularJS アプリケーションのビューでリンクを作成しようとしています。

私のルート:

app.delete('/logout', function(req, res) {
   req.session = null
   res.status(200)
   res.redirect('/')
})

私の PugJS テンプレート:

a(ng-href='/logout', data-method='delete', data-confirm='Are you sure?', rel='nofollow')
          span(translate) Logout  

生成された HTML:

<a ng-href="/logout" data-method="delete" data-confirm="Are you sure?" rel="nofollow" class="" href="/logout">
   <span translate="translate" class="ng-scope">
      <span class="ng-scope">Logout</span>
   </span>
</a>

しかし、リンクをたどると、次のメッセージが表示されます。

Cannot GET /logout

データメソッドが機能していないようです。何が起こっているのか知っている人はいますか?

しばらくありがとう。

4

1 に答える 1