Commit 9b1de3c6 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

add json output

parent 8dfc0c02
Loading
Loading
Loading
Loading
+20 −9
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@ sub handle_request {
	$self->stash( title      => 'db-fakedisplay' );
	$self->stash( version    => $VERSION );

	if ( not( $template ~~ [qw[clean multi single]] ) ) {
	if ( not( $template ~~ [qw[clean json multi single]] ) ) {
		$template = 'multi';
	}

@@ -194,6 +194,16 @@ sub handle_request {
		);
	}

	if ( $template eq 'json' ) {
		$self->render(
			json => {
				preformatted => \@departures,
				version      => $VERSION,
				raw          => \@results,
			}
		);
	}
	else {
		$self->render(
			$template,
			departures       => \@departures,
@@ -203,6 +213,7 @@ sub handle_request {
			hide_opts        => $hide_opts,
		);
	}
}

get '/_redirect' => sub {
	my $self    = shift;