Skip to content
This repository has been archived by the owner on Feb 17, 2020. It is now read-only.

angel-dart-archive/typed_service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

typed_service

Angel services that use reflection (via mirrors or codegen) to (de)serialize PODO's. Useful for quick prototypes.

Typically, package:angel_serialize is recommended.

Brief Example

main() async {
  var app = Angel();
  var http = AngelHttp(app);
  var service = TypedService<String, Todo>(MapService());
  hierarchicalLoggingEnabled = true;
  app.use('/api/todos', service);

  app
    ..serializer = god.serialize
    ..logger = Logger.detached('typed_service')
    ..logger.onRecord.listen((rec) {
      print(rec);
      if (rec.error != null) print(rec.error);
      if (rec.stackTrace != null) print(rec.stackTrace);
    });

  await http.startServer('127.0.0.1', 3000);
  print('Listening at ${http.uri}');
}

Releases

No releases published

Packages

No packages published

Languages