ich diesen Code js haben:Req.body = {} nach Anfrage Post
app.use(express.static(__dirname));
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json()); // support json encoded bodies
app.get('/', function(req, res){
res.sendFile(__dirname+'index.html')
});
app.get('/ins.html', function(req, res){
res.sendFile(__dirname+'ins.html')
});
app.post('/ins', function(req, res){
console.log(req.body)
res.redirect('/')
});
Und diesen Code html:
<form method="post" enctype="multipart/form-data" action="/ins"><p> <strong>INSERISCI LA TUA CAGATA<br></strong>
<br><p>Username </p> <input type="text" name="username" required><br>
<br><p>Password  </p> <input type="password" name="password" required><br><br><br>
<input type="submit" class="mainBtn" id="submit" value="Inserisci Cagata">
<p>
</form></h2>
Wenn ich auf die Seite gehen, in Show che Konsole „{ } "und ich habe keinen Zugriff in der POST-Variable. Wie kann ich das Problem lösen?