Method not allowed. Must be one of: POST - Slim Framework
<p>I'm trying to write a restful webservice using php + slim framework. It consists in a mongodb database of pokemons that allows clients to search infos about pokemons. First there's a html form that collects the fields of search and sends it with POST method to the server. At the server there's the code bellow:</p>

<pre><code>$app-&gt;post('/', function(Request $req, Response $res){

    $n = $req-&gt;getParsedBody(); 

});
</code></pre>

<p>but when I run the program a get the error:</p>

<pre><code>Method not allowed. Must be one of: POST
</code></pre>

<p>here is the server file:</p>

<pre><code>&lt;?php


use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;

require 'vendor/autoload.php';

$con = new MongoClient("mongodb://localhost:27017");
$db = $con-&gt;pokemon;
$colec = $db-&gt;pokemon;

$app = new \Slim\App;

// $app-&gt;get('/', function($campo) {

//  echo $campo."&lt;br&gt;";


   // });


$app-&gt;post('/', function(Request $req, Response $res){

    $n = $req-&gt;getParsedBody(); 

});


$app-&gt;run();

?&gt;
</code></pre>

<p>here is the html file:</p>

<pre><code>    &lt;html&gt;
&lt;head&gt;
    &lt;title&gt;Pokedex&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;

&lt;link rel="stylesheet" type="text/css" href="estilo.css"&gt;
&lt;img id="img" src="../Pokemon/img/pkm.png"/&gt;

&lt;div id="primeiraDiv"&gt;
    &lt;form id="formulario1" action="servidor.php" method="POST"&gt;
        &lt;p&gt;Pesquisar Pokemon por nome:&lt;/p&gt;
        &lt;input type="text" name="nome" id="nome"&gt;
        &lt;input type="submit" name="botao" id="botao" value="buscar"&gt;
    &lt;/form&gt;
&lt;/div&gt;

&lt;div id="segundaDiv"&gt;
    &lt;form action="servidor.php" method="POST" name="formulario2"&gt;
        &lt;p&gt;Pesquisar Pokemon por tipo:&lt;/p&gt;
        &lt;input type="text" name="tipo" id="tipo"&gt;
        &lt;input type="submit" name="botao" id="botao" value="buscar"&gt;
    &lt;/form&gt;
&lt;/div&gt;

&lt;div id="terceiraDiv"&gt;
    &lt;form action="servidor.php" method="POST" name="formulario3"&gt;
        &lt;input type="submit" id="listar" nome="listar" value="Listar Todos Pokemons"&gt;
    &lt;/form&gt;
&lt;/div&gt;
</code></pre>

<p>
</p>

<p>how do i fix it?    </p>