angel_framework 1.1.4+3

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 92

angel_framework

Pub build status

A high-powered HTTP server with support for dependency injection, sophisticated routing and more.

This is the core of the Angel framework. To build real-world applications, please see the homepage.

import 'package:angel_framework/angel_framework.dart';

main() async {
  var app = new Angel();

  // Index route. Returns JSON.
  app.get('/', () => 'Welcome to Angel!');

  // Accepts a URL like /greet/foo or /greet/bob.
  app.get('/greet/:name', (String name) => 'Hello, $name!');

  // Pattern matching - only call this handler if the query value of `name` equals 'emoji'.
  app.get('/greet', (@Query('name', match: 'emoji') String name) => '😇🔥🔥🔥');

  // Handle any other query value of `name`.
  app.get('/greet', (@Query('name') String name) => 'Hello, $name!');

  // Simple fallback to throw a 404 on unknown paths.
  app.use((RequestContext req) async {
    throw new AngelHttpException.notFound(
      message: 'Unknown path: "${req.uri.path}"',
    );
  });

  var http = new AngelHttp(app);
  var server = await http.startServer('127.0.0.1', 3000);
  var url = 'http://${server.address.address}:${server.port}';
  print('Listening at $url');
  print('Visit these pages to see Angel in action:');
  print('* $url/greet/bob');
  print('* $url/greet/?name=emoji');
  print('* $url/greet/?name=jack');
  print('* $url/nonexistent_page');
}

1.1.4+3

  • Don't create a Stopwatch in production.
  • Fix a bug where handleAngelHttpException created a race condition.
  • ResponseContext.serialize now returns a bool.

1.1.4+2

  • Fix a bug that prevented proper rendering of views.
  • Fixed a hidden bug that prevents error handling when a stack trace is null.
  • Fixed a bug that prevented proper handling of content-encoding.

1.1.4+1

  • Ensure correct error handling when useZone is false.

1.1.4

  • Remove all usages of async/await in the core library.
  • AngelConfigurer now accepts FutureOr.
  • AngelHttp now has a useZone flag to disable custom zones.

1.1.3

  • AngelHttp now handles requests in a Zone.
  • Use package:dart2_constant.

1.1.2

  • MapService will store created_at and updated_at as String.

1.1.1

  • ResponseContext no longer automatically closes if serializer returns an empty string.
  • Added autoSnakeCaseNames to MapService.
  • Deprecated Angel.createZoneForRequest.
  • Deprecated all Angel methods that directly touch an HttpServer or HttpRequest.
  • Created the AngelHttp class.
  • Removed explicit dependence on dart:io for Angel, RequestContext, ResponseContext.
  • Created lib/http.dart, which exports HTTP-specific functionality.
  • AnonymousService now takes FutureOr.
  • Service.toId no longer only takes a String, and is generically-typed.

1.1.0+3

  • Modified ResponseContext#isOpen to also return false if streaming is being used.

1.1.0+2

  • Modified handleAngelHttpException to only run rescue code if the response is still open. Prevents application crashes.

1.1.0+1

  • Modified _matchesId in MapService to support custom ID fields.

1.1.0

  • The default errorHandler now only sends HTML if the user explicitly accepts it.

1.1.0-alpha+9

  • Fixed a bug that prevented isProduction from ever returning true.
    • This enabled caching, which greatly improved performance.
  • Requests no longer have independent zones, which greatly improved performance.
  • FormatException, when caught, is automatically transformed in a 400 error response.
  • Added extension to RequestContext.
  • Added strict to RequestContext#accepts.
  • Added a toString override for the Providers class.
  • Returned to RegExp for stripping stray slashes.
  • The request path is now only parsed once.
  • Optimized the parsing of the ACCEPT_ENCODING header.

1.1.0-alpha+8

  • Added an autoIdAndDateFields flag to MapService. Finally.

1.1.0-alpha+7

  • Made handlerCache public.
  • Added AngelMetrics.

1.1.0-alpha+6

  • Added @Parameter() annotations, with support for pattern matching.

1.1.0-alpha+5

  • Closed #166, killing any hanging Stopwatch instances when streaming.
  • Removed AngelPlugin and AngelMiddleware, as well as the @proxy annotations from Angel and RequestContext.
  • Officially deprecated properties in Angel.
  • Fixed a bug where cached routes would not heed the request method. #173
  • Reworked error handling logic; now, errors will not automatically default to sending JSON.
  • Removed the onController stream from Angel.
  • Controllers now longer use call, which has now been renamed to configureServer.

1.1.0-alpha+4

  • Made injections in RequestContext private.
  • Renamed properties in AngelBase to configuration.

1.1.0-alpha+3

  • Fixed a bug where encoders would cause a malformed response to be sent.
  • Fixed a bug where encoders would not always use the correct encoder.

1.1.0-alpha

  • Removed AngelFatalError, and subsequently fatalErrorStream.
  • Removed all @deprecated members.
  • Removed @Hooked, beforeProcessed, and afterProcessed.

example/main.dart

import 'package:angel_framework/angel_framework.dart';

main() async {
  var app = new Angel();

  // Index route. Returns JSON.
  app.get('/', () => 'Welcome to Angel!');

  // Accepts a URL like /greet/foo or /greet/bob.
  app.get('/greet/:name', (String name) => 'Hello, $name!');

  // Pattern matching - only call this handler if the query value of `name` equals 'emoji'.
  app.get('/greet', (@Query('name', match: 'emoji') String name) => '😇🔥🔥🔥');

  // Handle any other query value of `name`.
  app.get('/greet', (@Query('name') String name) => 'Hello, $name!');

  // Simple fallback to throw a 404 on unknown paths.
  app.use((RequestContext req) async {
    throw new AngelHttpException.notFound(
      message: 'Unknown path: "${req.uri.path}"',
    );
  });

  var http = new AngelHttp(app);
  var server = await http.startServer('127.0.0.1', 3000);
  var url = 'http://${server.address.address}:${server.port}';
  print('Listening at $url');
  print('Visit these pages to see Angel in action:');
  print('* $url/greet/bob');
  print('* $url/greet/?name=emoji');
  print('* $url/greet/?name=jack');
  print('* $url/nonexistent_page');
}

Use this package as a library

1. Depend on it

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


dependencies:
  angel_framework: "^1.1.4+3"

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support 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_framework/angel_framework.dart';
  
Version Uploaded Documentation Archive
1.1.4+3 Jun 10, 2018 Go to the documentation of angel_framework 1.1.4+3 Download angel_framework 1.1.4+3 archive
1.1.4+2 Jun 10, 2018 Go to the documentation of angel_framework 1.1.4+2 Download angel_framework 1.1.4+2 archive
1.1.4+1 Jun 8, 2018 Go to the documentation of angel_framework 1.1.4+1 Download angel_framework 1.1.4+1 archive
1.1.4 Jun 8, 2018 Go to the documentation of angel_framework 1.1.4 Download angel_framework 1.1.4 archive
1.1.3 May 16, 2018 Go to the documentation of angel_framework 1.1.3 Download angel_framework 1.1.3 archive
1.1.2 Mar 30, 2018 Go to the documentation of angel_framework 1.1.2 Download angel_framework 1.1.2 archive
1.1.1 Feb 7, 2018 Go to the documentation of angel_framework 1.1.1 Download angel_framework 1.1.1 archive
1.1.0+3 Dec 12, 2017 Go to the documentation of angel_framework 1.1.0+3 Download angel_framework 1.1.0+3 archive
1.1.0+2 Dec 12, 2017 Go to the documentation of angel_framework 1.1.0+2 Download angel_framework 1.1.0+2 archive
1.1.0+1 Dec 10, 2017 Go to the documentation of angel_framework 1.1.0+1 Download angel_framework 1.1.0+1 archive

All 140 versions...

Analysis

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

  • Dart: 2.0.0-dev.60.0
  • pana: 0.11.3

Scores

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

Platforms

Detected platforms: other

Primary library: package:angel_framework/angel_framework.dart with components: io, mirrors.

Suggestions

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 9 hints.

    Run dartfmt to format lib/http.dart.

    Run dartfmt to format lib/src/core/core.dart.

    Similar analysis of the following files failed:

    • lib/src/core/hooked_service.dart (hint)
    • lib/src/core/service.dart (hint)
    • lib/src/http/controller.dart (hint)
    • lib/src/http/http.dart (hint)
    • lib/src/stats/metric_server.dart (hint)

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.19.0 <3.0.0
angel_http_exception ^1.0.0 1.0.0
angel_model ^1.0.0 1.0.0
angel_route ^2.0.0 2.0.6
body_parser ^1.0.0-dev 1.1.0
charcode ^1.0.0 1.1.1
combinator >=1.0.0-beta <2.0.0 1.0.0
container ^0.1.2 0.1.2
dart2_constant ^1.0.0 1.0.1+dart2
http_parser ^3.0.0 3.1.2
json_god ^2.0.0-beta 2.0.0-beta+1
logging >=0.11.3 <1.0.0 0.11.3+1
matcher ^0.12.0 0.12.2+1
merge_map ^1.0.0 1.0.0
meta ^1.0.0 1.1.5
mime ^0.9.3 0.9.6+1
path >=1.0.0 <2.0.0 1.6.0
pool ^1.0.0 1.3.5
random_string ^0.0.1 0.0.1
stack_trace ^1.0.0 1.9.2
tuple ^1.0.0 1.0.1
Transitive dependencies
async 2.0.7
code_buffer 1.0.0
collection 1.14.10
http_server 0.9.7
quiver_hashcode 1.0.0
source_span 1.4.0
string_scanner 1.0.2
typed_data 1.1.5
Dev dependencies
angel_jael ^1.0.0
http ^0.11.3
mock_request ^1.0.0
test ^0.12.13