martin823823
V2EX  ›  Node.js

这个 post 请求的写法是否正确,能够请求到数据吗

  •  
  •   martin823823 · Aug 29, 2015 · 3565 views
    This topic created in 3935 days ago, the information mentioned may be changed or developed.
    app.post ('/tasks',function (req, res ){
    var task = new Task (req.body.task );

    task.save (function (err ) {
    if (err ) {
    throw err;
    }
    else {
    res.redirect ('/tasks/new');
    }
    });
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2904 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 09:12 · PVG 17:12 · LAX 02:12 · JFK 05:12
    ♥ Do have faith in what you're doing.