title: How to pass client-side parameters to the server-side in Angular/Node.js/Express
body: <p>Probably a very basic question, but I cannot seem to find a simple answer. </p>
  
  <p>I have a GET method leveraging Angular's <code>$http</code> that is requesting a promise from a particular url (<code>URL_OF_INTEREST</code>).</p>
  
  <p>On this server, I run an express script <code>server.js</code> script that can handle GET requests.</p>
  
  <p><strong>server.js</strong></p>
  
  <pre><code>var express    = require('express');        // call express
  var app        = express();                 // define our app using express
  var bodyParser = require('body-parser');
  var stripe     = require("stripe")("CUSTOM_TEST_TOKEN");
  
  app.use(bodyParser.urlencoded({ extended: true }));
  app.use(bodyParser.json());
  
  var port = process.env.PORT || 8080;        
  var router = express.Router();              // get an instance of the express Router
  
  router.get('/', function(req, res, next) {
  
      var stripeToken = "CUSTOM_PAYMENT_TOKEN";
  
      var charge = stripe.charges.create({
          amount: 1100, // amount in cents, again
          currency: "usd",
          source: stripeToken,
          description: "Example charge"
      }, function(err, charge) {
          if (err &amp;&amp; err.type === 'StripeCardError') {
              res.json(err);   
          } else {
              res.json(charge);   
          }
      });
  });
  
  app.use(function(req, res, next) {
      res.header("Access-Control-Allow-Origin", "*");
      res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
  
      next();
  })
  
  app.use('/api', router); // register our route
  app.listen(port); // start our server
  console.log('Magic happens on port ' + port);
  </code></pre>
  
  <p>I can communicate with the URL_OF_INTEREST using an Angular GET method as follows:</p>
  
  <pre><code>$http.get('URL_OF_INTEREST')
          .success(
              function(success){
                  console.log(success)
              })
          .error(
              function(error){
                  console.log(error)
              });
  </code></pre>
  
  <p>However, the fields amount, currency, source and description need to be ideally passed on from the Angular client side application.</p>
  
  <p>How can this be achieved and how can my express application read this data?</p>