use v6.d.PREVIEW;
use Ultramarine::Model::License;
use Ultramarine::Model::Users;
use Ultramarine::Middleware::Authentication;
use Ultramarine::Middleware::Authorisation;
use Ultramarine::Middleware::SetContentType;
use Ultramarine::Serialiser::XML;
use Ultramarine::Serialiser::JSON;
use Ultramarine::Controller;
use Ultramarine::Server;
my $users = Ultramarine::Model::Users.new(
accounts=> { me => 'sesame' },
);
my $controller = Ultramarine::Controller.new(
license => Ultramarine::Model::License.new,
authorisation => Ultramarine::Middleware::Authorisation.new,
).routes;
my $server = Ultramarine::Server.new(
:host<192.168.1.145>,
:port<8080>,
:$controller,
authentication => Ultramarine::Middleware::Authentication.new(:$users),
serialisers => [
Ultramarine::Serialiser::XML.new,
Ultramarine::Serialiser::JSON.new,
],
set-content-type => Ultramarine::Middleware::SetContentType.new,
do-trace => True,
).server;
$server.start;
say "ready";
react whenever signal(SIGINT) {
$server.stop;
exit;
}