angel_gopher 0.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • new48

angel_gopher #

Angel bindings for the Gopher protocol.

import 'package:angel_framework/angel_framework.dart';
import 'package:angel_gopher/angel_gopher.dart';
import 'package:logging/logging.dart';
import 'package:pretty_logging/pretty_logging.dart';

// Fetch JSON in bash using `nc`:
//  * `echo '/json' | nc 127.0.0.1 7070 | jq .`
//  * `curl -s gopher://127.0.0.1:7070/0/json | jq .`
//
// View in Lynx browser:
//  * `lynx gopher://127.0.0.1:7070`
//  * `lynx gopher://127.0.0.1:7070/0/hello`
//  * `lynx gopher://127.0.0.1:7070/0/json`

main() async {
  var logger = Logger('example')..onRecord.listen(prettyLog);
  var app = Angel(logger: logger), gopher = AngelGopher(app);

  app.get('/', (req, res) {
    if (res is GopherResponseContext) {
      res..writeFileItem('Hello', '/hello')..writeFileItem('JSON', '/json');
    } else {
      res.write('Endpoints: /hello and /json');
    }
  });

  app.get('/hello', (req, res) => res.write('Hello, Gopher world!'));

  app.get('/json', (req, res) => {'this': 'is json!!!'});

  app.fallback((req, res) => throw AngelHttpException.notFound(
      message: 'No file exists at path ${req.uri.path}.'));

  await gopher.startServer('127.0.0.1', 7070);
  print('angel_gopher example listening at ${gopher.uri}');
}

0.0.0 #

  • First version (no unit tests).

example/main.dart

import 'package:angel_framework/angel_framework.dart';
import 'package:angel_gopher/angel_gopher.dart';
import 'package:logging/logging.dart';
import 'package:pretty_logging/pretty_logging.dart';

// Fetch JSON in bash using `nc`:
//  * `echo '/json' | nc 127.0.0.1 7070 | jq .`
//  * `curl -s gopher://127.0.0.1:7070/0/json | jq .`
//
// View in Lynx browser:
//  * `lynx gopher://127.0.0.1:7070`
//  * `lynx gopher://127.0.0.1:7070/0/hello`
//  * `lynx gopher://127.0.0.1:7070/0/json`

main() async {
  var logger = Logger('example')..onRecord.listen(prettyLog);
  var app = Angel(logger: logger), gopher = AngelGopher(app);

  app.get('/', (req, res) {
    if (res is GopherResponseContext) {
      res..writeFileItem('Hello', '/hello')..writeFileItem('JSON', '/json');
    } else {
      res.write('Endpoints: /hello and /json');
    }
  });

  app.get('/hello', (req, res) => res.write('Hello, Gopher world!'));

  app.get('/json', (req, res) => {'this': 'is json!!!'});

  app.fallback((req, res) => throw AngelHttpException.notFound(
      message: 'No file exists at path ${req.uri.path}.'));

  await gopher.startServer('127.0.0.1', 7070);
  print('angel_gopher example listening at ${gopher.uri}');
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  angel_gopher: ^0.0.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:angel_gopher/angel_gopher.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
48
Learn more about scoring.

We analyzed this package on Oct 12, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, other

Primary library: package:angel_gopher/angel_gopher.dart with components: io.

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
angel_container ^1.0.0 1.1.0
angel_framework ^2.0.0 2.0.4+1 2.0.5-beta
async ^2.0.0 2.4.0
gopher ^0.0.0 0.0.0
mock_request ^1.0.0 1.0.6
Transitive dependencies
angel_http_exception 1.1.0
angel_model 1.0.3
angel_route 3.0.6
charcode 1.1.2
code_buffer 1.0.1
collection 1.14.12
combinator 1.1.0
convert 2.1.1
crypto 2.1.3
dart2_constant 1.0.2+dart2
file 5.1.0
http2 1.0.0
http_parser 3.1.3
http_server 0.9.8+3
intl 0.16.0
matcher 0.12.5
merge_map 1.0.2
meta 1.1.7
mime 0.9.6+3
path 1.6.4
quiver 2.0.5
quiver_hashcode 2.0.0
source_span 1.5.5
stack_trace 1.9.3
string_scanner 1.0.5
term_glyph 1.1.0
tuple 1.0.3
typed_data 1.1.6
uuid 2.0.2
Dev dependencies
logging ^0.11.0 0.11.3+2
pedantic ^1.0.0 1.8.0+1
pretty_logging ^1.0.0
test ^1.0.0