From 8af3af05f8ed0622864f9d6fa2ad40a0f502c525 Mon Sep 17 00:00:00 2001 From: thosakwe Date: Sun, 19 Feb 2017 07:57:47 -0500 Subject: [PATCH] Added validators --- lib/src/routes/routes.dart | 2 +- lib/src/validators/user.dart | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 lib/src/validators/user.dart diff --git a/lib/src/routes/routes.dart b/lib/src/routes/routes.dart index 996cac0..846d665 100644 --- a/lib/src/routes/routes.dart +++ b/lib/src/routes/routes.dart @@ -31,7 +31,7 @@ configureAfter(Angel app) async { var req = await RequestContext.from(e.request, app); var res = new ResponseContext(e.request.response, app); res.render('error', {'message': 'Internal Server Error: ${e.error}'}); - await app.sendRequest(e.request, req, res); + await app.sendResponse(e.request, req, res); }; // Throw a 404 if no route matched the request diff --git a/lib/src/validators/user.dart b/lib/src/validators/user.dart new file mode 100644 index 0000000..9080ce7 --- /dev/null +++ b/lib/src/validators/user.dart @@ -0,0 +1,7 @@ +import 'package:angel_validate/angel_validate.dart'; + +final Validator CREATE_USER = new Validator({ + 'email*': [isString, isEmail], + 'username*': [isString, isNotEmpty], + 'password*': [isString, isNotEmpty] +});