Skip to content
Create a gist now

Instantly share code, notes, and snippets.

@Meettya / forked from und3f/
Created Feb 25, 2011

package NoticeBackend::Author;
use Mojo::Base 'Mojolicious::Controller';
use 5.12.0;
use warnings;
use utf8;
use MojoX::Redis;
use Mojo::IOLoop;
my $redis = MojoX::Redis->new(server => '');
my ($redis_out);
sub get{
my $self = shift;
my $user_query = $self->req->is_xhr ?
$self->req->json->{'name'} : $self->param('name');
my $callback_name = $self->req->is_xhr ?
$self->req->json->{'callback'} : $self->param('callback');
my $data_out;
$redis->get( $user_query => sub {
my ($redis, $res) = @_;
$data_out = $res->[0];
$self->render( text => "|$data_out|" );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.