Added validators

This commit is contained in:
thosakwe 2017-02-19 07:57:47 -05:00
parent b29ad2c807
commit 8af3af05f8
2 changed files with 8 additions and 1 deletions

View file

@ -31,7 +31,7 @@ configureAfter(Angel app) async {
var req = await RequestContext.from(e.request, app); var req = await RequestContext.from(e.request, app);
var res = new ResponseContext(e.request.response, app); var res = new ResponseContext(e.request.response, app);
res.render('error', {'message': 'Internal Server Error: ${e.error}'}); 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 // Throw a 404 if no route matched the request

View file

@ -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]
});