Make sure you have the methodoveride middleware enabled


On Thu, Feb 14, 2013 at 12:04 AM, Pavel Vašek <[email protected]> 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 [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> 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 [email protected].
> 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to