{"id":16163963,"url":"https://github.com/rawleyfowler/net-gemini","last_synced_at":"2025-04-07T04:45:17.754Z","repository":{"id":132530762,"uuid":"588407268","full_name":"rawleyfowler/Net-Gemini","owner":"rawleyfowler","description":"Client/Server implementation of the Gemini protocol for Raku","archived":false,"fork":false,"pushed_at":"2023-01-18T13:45:49.000Z","size":28,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-13T08:54:22.510Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Raku","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"artistic-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rawleyfowler.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-13T03:19:55.000Z","updated_at":"2024-11-30T07:28:52.000Z","dependencies_parsed_at":"2023-05-17T03:45:08.409Z","dependency_job_id":null,"html_url":"https://github.com/rawleyfowler/Net-Gemini","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rawleyfowler%2FNet-Gemini","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rawleyfowler%2FNet-Gemini/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rawleyfowler%2FNet-Gemini/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rawleyfowler%2FNet-Gemini/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rawleyfowler","download_url":"https://codeload.github.com/rawleyfowler/Net-Gemini/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247595374,"owners_count":20963942,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T02:44:53.000Z","updated_at":"2025-04-07T04:45:17.727Z","avatar_url":"https://github.com/rawleyfowler.png","language":"Raku","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Net::Gemini\n\n[![SparrowCI](https://ci.sparrowhub.io/project/gh-rawleyfowler-Net-Gemini/badge)](https://ci.sparrowhub.io)\n\nClient/Server implementation of the Gemini protocol, including a simple API for creating responses.\n\n## How to use\n\n#### Client\n```raku\nuse Net::Gemini;\n\nmy $client = Net::Gemini::Client('gemini://gemini.website.space') # Defaults port to 1965, specify port if you want.\nreact {\n    whenever $client {\n        say $_; # You'll see the response here!\n    }\n}\n```\n\n#### Server\n\n##### File Server\n```raku\nuse Net::Gemini;\n\nmy $domain = 'www.bob.com';\nmy $port = 1965; # This is defaulted if not provided\nmy $cert-file = 'cert.pem'; # TLS is required for Gemini, so you need a cert file and priv-key\nmy $cert-key-file = 'priv-key.pem';\nNet::Gemini::Server.new(:$domain, :$port, :$cert-file, :$cert-key-file).listen;\n# This will serve .gmi and .gmni files from $*CWD/public\n# If you include index.gmi in the directory you'll see it become available on the root route.\n```\n\n##### Custom Handler Server\n```raku\nuse Net::Gemini;\n\n# Same as file server\nmy $domain = 'www.bob.com';\nmy $port = 1965; # This is defaulted if not provided\nmy $cert-file = 'cert.pem'; # TLS is required for Gemini, so you need a cert file and priv-key\nmy $cert-key-file = 'priv-key.pem';\n\n# Custom handler for requests.\nsub my-handler(Str $request --\u003e Net::Gemini::Response) {\n    # There are some generic/pre-built functions for generating responses in\n    # Response.rakumod, these help a lot!\n    if $request eq ('gemini://www.bob.com/') {\n        Net::Gemini::Response::make-generic-redirect-response(31, 'gemini://www.bob.com/redirect');\n    } else {\n        Net::Gemini::Response::make-resource-response('awesome-page.gmi'); # In this case let's just always serve\n    }\n}\n\n# Alternatively, if you understand the Gemini protocol you can build response using the Net::Gemini::Response class.\n\nNet::Gemini::Server.new(:$domain, :$port, :$cert-file, :$cert-key-file).listen(\u0026my-handler);\n```\n\n## License\nThis project is available under the Artistic-2.0 license, the same as Raku.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frawleyfowler%2Fnet-gemini","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frawleyfowler%2Fnet-gemini","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frawleyfowler%2Fnet-gemini/lists"}