burguillos.info/lib/BurguillosInfo/Controller/Ads.pm

20 lines
454 B
Perl
Raw Normal View History

2023-08-21 00:58:11 +02:00
package BurguillosInfo::Controller::Ads;
use v5.34.1;
use strict;
use warnings;
use BurguillosInfo::Ads;
use Mojo::Base 'Mojolicious::Controller', '-signatures';
sub next_ad {
my $self = shift;
my $ads_factory = BurguillosInfo::Ads->new;
my $current_ad_number = $self->param('n');
$self->res->headers->access_control_allow_origin('*');
2023-08-21 00:58:11 +02:00
$self->render( json => $ads_factory->get_next($current_ad_number) );
}
1;