MakeThemPay/lib/MakeThemPay.pm

30 lines
748 B
Perl
Raw Normal View History

2024-10-24 13:54:16 +02:00
package MakeThemPay;
use Mojo::Base 'Mojolicious', -signatures;
# This method will run once at server start
sub startup ($self) {
2024-11-02 21:27:23 +01:00
# Load configuration from config file
my $config = $self->plugin('NotYAMLConfig');
$self->config(
hypnotoad => {
proxy => 1,
listen => [ $self->config('listen') // 'http://localhost:3000' ]
}
);
2024-10-24 13:54:16 +02:00
2024-11-02 21:27:23 +01:00
# Configure the application
$self->secrets( $config->{secrets} );
2024-10-24 13:54:16 +02:00
2024-11-02 21:27:23 +01:00
# Router
my $r = $self->routes;
2024-10-24 13:54:16 +02:00
2024-11-02 21:27:23 +01:00
# Normal route to controller
$r->get('/get_pay_url/:uuid')->to('Main#get_url');
$r->get('/price/:uuid')->to('Main#price');
2024-11-02 21:27:23 +01:00
$r->get('/set_paid/:uuid')->to('Main#set_paid');
$r->get('/get_paid/:uuid')->to('Main#get_paid');
2024-10-24 13:54:16 +02:00
}
1;