title: Angular 2: Method DELETE is not allowed by Access-Control-Allow-Methods in preflight response
body: <p>I need to delete a record on my mongodb using mongoose.</p>
  
  <p>Here is my component</p>
  
  <pre><code> deleteProduct(product){
          this._confirmationService.confirm({
              message: 'Are you sure you want to delete the item?',
              accept: () =&gt; {
                  this._productsAdminService.deleteProduct(product._id)
                      .subscribe(products =&gt; {
                          products.forEach(function(product){
                              if(product.cat_id === 1) product.catName = 'Dota Shirts';
                              if(product.cat_id === 2) product.catName = 'Gym Shirts';
                              if(product.cat_id === 3) product.catName = 'Car Shirts';
                          });
                          this.products = products;
                      },
                      err =&gt; console.log(err));
              }
          })
      }
  </code></pre>
  
  <p>basically this will just pass the product id to the service to execute http request.</p>
  
  <p>Here is my service</p>
  
  <pre><code>deleteProduct(productId){
      let headers = new Headers({'Authorization': 'JWT ' + localStorage.getItem('currentUserToken')});
      let options = new RequestOptions({ headers: headers});
      return this._http.delete('http://localhost:3000/admin/products/delete/' + productId, options)
          .map((response: Response) =&gt; response.json())
          .catch(this._handlerError);
  }
  </code></pre>
  
  <p>I am using the delete method to call my API in expressJS.</p>
  
  <p>Here is my API</p>
  
  <pre><code>productsAdminRouter.route('/delete/:productId')
      .delete(function(req,res){
          id = req.params.productId;
          console.log(id);
          Products.findByIdAndRemove(id)
              .exec(function(err, done){
                  if (err) throw err;
                  Products.find()
                      .exec(function(err, products){
                          res.json(products);
                      });
              });
      });
  </code></pre>
  
  <p>But I always got this error</p>
  
  <p><a href="https://i.stack.imgur.com/xEixs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xEixs.png" alt="enter image description here"></a></p>
  
  <p>Can anyone help? I'm stuck.</p>