gemini_server 1.0.2 copy "gemini_server: ^1.0.2" to clipboard
gemini_server: ^1.0.2 copied to clipboard

A low-level Gemini server.

example/gemini_server_example.dart

import 'dart:convert';
import 'dart:io';

import 'package:gemini_server/gemini_server.dart';

Future<Response> handler(Request request) async {
  return Response(
    statusCode: StatusCode.success,
    meta: "text/gemini",
    body: utf8.encode("# Hello World!"),
  );
}

void main() async {
  // WARNING: this is a self-signed certificate
  // created for example, please DO NOT use it in production!
  final context = SecurityContext()
    ..useCertificateChain("cert/cert.pem")
    ..usePrivateKey("cert/key.pem", password: "example");

  await GeminiServer.bind(
    address: InternetAddress.anyIPv4,
    port: 1965,
    context: context,
    callback: handler,
  );
}
0
likes
150
pub points
2%
popularity

Publisher

verified publisherarslee.dev

A low-level Gemini server.

Repository

Documentation

API reference

License

GPL-3.0 (license)

Dependencies

gemini_protocol

More

Packages that depend on gemini_server