martin823823
V2EX  ›  Node.js

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

  •  
  •   martin823823 · Aug 29, 2015 · 3622 views
    This topic created in 3976 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   ·   2953 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 07:40 · PVG 15:40 · LAX 00:40 · JFK 03:40
    ♥ Do have faith in what you're doing.