From 4b2aefd807db077bd138a3edbb3ab9743050cc69 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Thu, 18 Oct 2018 19:01:58 -0400 Subject: [PATCH] Add example --- example/example.dart | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 example/example.dart diff --git a/example/example.dart b/example/example.dart new file mode 100644 index 00000000..161c9173 --- /dev/null +++ b/example/example.dart @@ -0,0 +1,15 @@ +import 'package:angel_framework/angel_framework.dart'; +import 'package:angel_mongo/angel_mongo.dart'; +import 'package:mongo_dart/mongo_dart.dart'; + +main() async { + var app = new Angel(); + Db db = new Db('mongodb://localhost:27017/local'); + await db.open(); + + var service = app.use('/api/users', new MongoService(db.collection("users"))); + + service.afterCreated.listen((event) { + print("New user: ${event.result}"); + }); +}