I would like that email had format like: a@b.c.
Which is the best way to do it?
I have a component for registration and I have the field like this:
<mat-form-field>
<input matInput placeholder="Email" name="email" [(ngModel)]="email" required>
</mat-form-field>
In my usersRouter I have the function for registration:
router.post('/users/register', (req, res) => {
...
const user = new User({
...
email: req.body.email,
...
});
...
});
Also, I use mongo and in the UserSchema I have this for the email:
email: {
type: String,
required: true
}
Thanks!