FAQ
Hi, I have a problem with the API, when you request a PUT Cannot PUT.

use express, express-resource

thanks

--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Pavel Vašek at Feb 13, 2013 at 8:55 pm
    Hi Dan,

    This is probably question about express so you should use this group:
    https://groups.google.com/forum/?fromgroups#!forum/express-js

    I think I had a similar issue and the trick was to return something or at
    least set result code.

    I defined a helper method in app.js

    app.resource = function(path, obj) {
    this.get(path, obj.getList);
    this.get(path + '/:id', function(req, res){
    obj.get(req, res, parseInt(req.params.id, 10));
    });
    this.del(path + '/:id', function(req, res){
    obj.delete(req, res, parseInt(req.params.id, 10));
    });
    this.put(path + '/:id', function(req, res){
    obj.put(req, res, parseInt(req.params.id, 10));
    });
    this.post(path, obj.post);
    };

    then use it for routes definition

    app.resource('/projects', require('./routes/project'));

    and finally the routes looks like this

    exports.put = function(req, res, id) {

    // updating logic ...

    res.json({id: id});
    };

    hope this help

    Pavel
    On Wednesday, February 13, 2013 3:03:13 PM UTC+1, Radim Daniel Pánek wrote:

    Hi, I have a problem with the API, when you request a PUT Cannot PUT.

    use express, express-resource

    thanks
    --
    --
    Job Board: http://jobs.nodejs.org/
    Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
    You received this message because you are subscribed to the Google
    Groups "nodejs" group.
    To post to this group, send email to nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    For more options, visit this group at
    http://groups.google.com/group/nodejs?hl=en?hl=en

    ---
    You received this message because you are subscribed to the Google Groups "nodejs" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Cming xu at Feb 15, 2013 at 10:48 am
    Make sure you have the methodoveride middleware enabled


    On Thu, Feb 14, 2013 at 12:04 AM, Pavel Vašek wrote:

    Hi Dan,

    This is probably question about express so you should use this group:
    https://groups.google.com/forum/?fromgroups#!forum/express-js

    I think I had a similar issue and the trick was to return something or at
    least set result code.

    I defined a helper method in app.js

    app.resource = function(path, obj) {
    this.get(path, obj.getList);
    this.get(path + '/:id', function(req, res){
    obj.get(req, res, parseInt(req.params.id, 10));
    });
    this.del(path + '/:id', function(req, res){
    obj.delete(req, res, parseInt(req.params.id, 10));
    });
    this.put(path + '/:id', function(req, res){
    obj.put(req, res, parseInt(req.params.id, 10));
    });
    this.post(path, obj.post);
    };

    then use it for routes definition

    app.resource('/projects', require('./routes/project'));

    and finally the routes looks like this

    exports.put = function(req, res, id) {

    // updating logic ...

    res.json({id: id});
    };

    hope this help

    Pavel

    On Wednesday, February 13, 2013 3:03:13 PM UTC+1, Radim Daniel Pánek wrote:

    Hi, I have a problem with the API, when you request a PUT Cannot PUT.

    use express, express-resource

    thanks

    --
    --
    Job Board: http://jobs.nodejs.org/
    Posting guidelines:
    https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
    You received this message because you are subscribed to the Google
    Groups "nodejs" group.
    To post to this group, send email to nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    For more options, visit this group at
    http://groups.google.com/group/nodejs?hl=en?hl=en

    ---
    You received this message because you are subscribed to the Google Groups
    "nodejs" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to nodejs+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

    --
    --
    Job Board: http://jobs.nodejs.org/
    Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
    You received this message because you are subscribed to the Google
    Groups "nodejs" group.
    To post to this group, send email to nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    For more options, visit this group at
    http://groups.google.com/group/nodejs?hl=en?hl=en

    ---
    You received this message because you are subscribed to the Google Groups "nodejs" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupnodejs @
categoriesnodejs
postedFeb 13, '13 at 3:19p
activeFeb 15, '13 at 10:48a
posts3
users3
websitenodejs.org
irc#node.js

People

Translate

site design / logo © 2022 Grokbase