Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^2: RESTful web-services in Perl

by onelesd (Pilgrim)
on Sep 22, 2011 at 21:23 UTC ( [id://927470]=note: print w/replies, xml ) Need Help??


in reply to Re: RESTful web-services in Perl
in thread RESTful web-services in Perl

Example REST in Dancer:

get '/service/items' => sub { content_type 'application/json' ; my $items = $dbh->selectall_arrayref(...) ; return to_json($items) ; } ; post '/service/items/:item_id' => sub { content_type 'application/json' ; $dbh->do(...) ; return to_json({updated => 1}) ; } ; put '/service/items' => sub { content_type 'application/json' ; $dbh->do(...) ; return to_json({added => 1}) ; } ; del '/service/items/:item_id' => sub { content_type 'application/json' ; $dbh->do(...) ; return to_json({deleted => 1}) ; } ;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://927470]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-04-16 19:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found