Added validators
This commit is contained in:
parent
b29ad2c807
commit
8af3af05f8
2 changed files with 8 additions and 1 deletions
|
@ -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
|
||||||
|
|
7
lib/src/validators/user.dart
Normal file
7
lib/src/validators/user.dart
Normal 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]
|
||||||
|
});
|
Loading…
Reference in a new issue