Slim frontend for API and serialization tests
diff --git a/lib/Korap.pm b/lib/Korap.pm
new file mode 100644
index 0000000..5d2cde0
--- /dev/null
+++ b/lib/Korap.pm
@@ -0,0 +1,48 @@
+package Korap;
+use Mojo::Base 'Mojolicious';
+
+# This method will run once at server start
+sub startup {
+ my $self = shift;
+
+ $self->plugin('Config');
+ $self->plugin('TagHelpers::Pagination');
+
+ push(@{$self->plugins->namespaces}, __PACKAGE__ . '::Plugin');
+ $self->plugin('KorapSearch');
+ $self->plugin('Notifications' => {
+ use => 'Humane'
+ });
+
+ $self->helper(
+ format_thousands => sub {
+ shift;
+ my ($n, @array) = @_;
+ while ($n =~ /\d\d\d\d/) {
+ $n =~ s/(\d\d\d)$//;
+ unshift @array, $1;
+ };
+ unshift @array, $n;
+ return join ',', @array;
+ }
+ );
+
+
+ # Router
+ my $r = $self->routes;
+
+ $r->add_shortcut(
+ search => sub {
+ shift->get('/search')->to('search#remote')
+ }
+ );
+
+# , resource => [qw/collection corpus/]
+ $r->get('/:resource')->search;
+ $r->get('/:resource/:cid', resource => [qw/collection corpus/])->search;
+ $r->get('/:resource/')->search;
+
+ # /matchInfo?id=...&f=&l=&spans
+}
+
+1;