How can I send post data to the api. I've collected the file from angular to node and I can display it via console.log() but I don't know how can the data file I've gain from angular send it using node js to the api using post request.
I have this code in my node and I'm using request module of node js.
'use strict';
import _ from 'lodash';
import request from 'request';
function fetch(method, url, req) {
  return new Promise(function(resolve, reject) {
    var options = {
      method: method,
      url: url,
      headers: {
        'Content-Type': 'application/json'
      }
    }
    if (method === 'GET' || method === 'DELETE') {
      options.headers = {};
      options.qs = req.query;
    } else {
      if (method !== 'DELETE') {
        options.body = JSON.stringify(req.body);
      }
    }
    if (req.headers.authorization) {
      options.headers['Authorization'] = req.headers.authorization;
    }
    if (method === 'DELETE') {
      delete options.qs;
    }
    console.log(req.file);
    request(options, function(error, response, body) {
      if (error) {
        return reject(error);
      }
      if (response.statusCode === 500) {
        return reject(body);
      }
      if (response.statusCode === 204) {
        return resolve({status: response.statusCode, body: 'no-content'});
      }
      try {
        var parsed = ( typeof(body) === 'object' ) ? body : JSON.parse(body);
        return resolve({status: response.statusCode, body: parsed});
      } catch(e) {
        return reject('[Error parsing api response]: ' + e);
      }
    });
  });
}
module.exports = {
  get: function(url, req) {
    return fetch('GET', url, req);
  },
  post: function(url, req) {
    return fetch('POST', url, req);
  },
  put: function(url, req) {
    return fetch('PUT', url, req);
  },
  delete: function(url, req) {
    return fetch('DELETE', url, req);
  }
};