Add example
This commit is contained in:
parent
e8a46d5804
commit
4b2aefd807
1 changed files with 15 additions and 0 deletions
15
example/example.dart
Normal file
15
example/example.dart
Normal file
|
@ -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}");
|
||||
});
|
||||
}
|
Loading…
Reference in a new issue