title: angular post json to express
body: <p>I'm trying to send a json to a server node/express with <code>angular.js</code></p>
  
  <p>my server.js</p>
  
  <pre><code>/*
  * Setup
  */
  // Dependencies
  var express = require('express');
  // Start Express
  var app = express();
  // Conf port
  var port = process.env.PORT || 3000;
  /*
  * Conf. the app
  */
      app.configure(function () {
          app.use(express.static(__dirname + '/public'));
          app.use(express.logger('dev'));
          app.use(express.bodyParser());
          app.use(express.methodOverride());
      });
  
  /*
  * Routes
  */
  require('./app/routes')(app);
  
  /*
  * Listen
  */
  app.listen(port);
  console.log("App listening on port " + port);
  </code></pre>
  
  <p>My Routes.js</p>
  
  <pre><code>module.exports = function (app) {
  
  app.post('/post/:name', function (req, res) {
      console.log("Serv get [OK]");
      /*
      * Disparar broadcast para all
      */
  });
  app.get('/', function (req, res) {
      res.sendfile('./public/view/index.html');
  });
  }
  </code></pre>
  
  <p>When my server is receiving a POST, I use:</p>
  
  <pre><code>app.post('/post'...
     OR
  app.get('/get'...
  </code></pre>
  
  <p>to capture the route ?</p>
  
  <p>My angular app is ok?</p>
  
  <pre><code>webchatApp = angular.module("webchatApp",[]);
  
  webchatApp.controller('webchatCtrl', function ($scope,$http) {
  $scope.sendMsg = function () {
      var dados = {name:"test message"};
      $http.post({url:'http://localhost/post/',data:dados})
          .success(function (data) {
              console.log("Success" + data);
          })
          .error(function(data) {
              console.log("Erro: "+data);
          })
  };
    });
  </code></pre>
  
  <p>the error: <code>Cannot POST /[object%20Object]</code>
  has something wrong with my post,<br> it will send: <strong>[object% 20Object]</strong></p>