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