javascript - Sails.js : redirection after http delete request -


I start with Sail.js and I'm not considered redirection. When I post and use res.redirect ("/ articles /"), I have no problem.

'Post / Article': 'ArticleController.create',

  create: function (req, res) {if (req.param ('titre') || ! Req.param ('resume') || | req.param ('contenu')) {res.status (400); Returns res.json (); } And (Article: (titre: req.param ('titre'), resume: req.param ('resume'), contenu: req.param ('contenu'), url: req. Param ('titre'). (= (Count) post () (if (error) {console.log ("erreur T_T"); console.log (err); return res.json (mistake);} other {console .log ("article about."); Console.log (post); res.redirect ("/ article /");}})}}  

but when it is a HTTP If I delete the request, I get a "not found" response:

'Delete / article': 'ArticleController.delete',

  Delete: function (Rick, Ridge) {if (! Req.param ('id')) {res.status (400); return res.json ();} {{Id: req.param ('id')}) Exec (Tasks (error, article) {if (article.length == 0) {console.log ("L'article n" ("id"); res.status (404); Return res. Json ();} else {console.log ("L'article a bn eti supermini"); console.log (article); res.redirect ("/ articles /");}});}},  

Thank you very much.


Edit:

The article is not null:

but my redirection does not work :


Edit 2: (more details)

  console.log ("a biennial etipter of the article"); // OK console.log (article); // OK res.redirect ("/ article /"); // works in another method but not here  


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

c# - NewtonSoft JArray - how to select multiple elements with LINQ -

javascript - amcharts makechart not working -