Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
simplify README examples
  • Loading branch information
kraih committed Feb 6, 2014
1 parent ea0ad16 commit fc5d656
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions README.md
Expand Up @@ -74,22 +74,12 @@ get '/' => {text => 'I ♥ Mojolicious!'};
# Route associating "/time" with template in DATA section
get '/time' => 'clock';

# RESTful web service with JSON and text representation
get '/list/:offset' => sub {
my $self = shift;
my $numbers = [0 .. $self->param('offset')];
$self->respond_to(
json => {json => $numbers},
txt => {text => join(',', @$numbers)}
);
};

# Scrape information from remote sites
post '/title' => sub {
my $self = shift;
my $url = $self->param('url') || 'http://mojolicio.us';
$self->render(
text => $self->ua->get($url)->res->dom->at('title')->text);
json => {title => $self->ua->get($url)->res->dom->at('title')->text});
};

# WebSocket echo service
Expand Down

0 comments on commit fc5d656

Please sign in to comment.