{"body":"class Auth does Cro::HTTP::Middleware::Conditional {\n    method process(Supply $requests) {\n        supply whenever $requests -> $request {\n            my %body = await $request.body;\n            my $user = User.^load(uuid => %body<auth>);\n            if $user {\n                emit $request;\n            }\n            else {\n                note \"[{ DateTime.now }] Failed authentication from {$request.connection.peer-host} (Auth: {%body<auth>})\";\n                emit Cro::HTTP::Response.new(:$request, :403status);\n            }\n        }\n    }\n}\n\nmy $application = route {\n    before Auth;\n    get -> 'character', $id {\n        request-body -> %request {\n            my $character = Character.^load($id);\n            note \"[{ DateTime.now }] Performing lookup on $id\";\n            if $character {\n                content 'application/json', $character.to-json;\n            } else {\n                not-found;\n            }\n        }\n    }\n}","name":"","extension":"txt","url":"https://www.irccloud.com/pastebin/2m6xdULK","modified":1647957897,"id":"2m6xdULK","size":946,"lines":30,"own_paste":false,"theme":"","date":1647957897}