I have this code js:
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('/')
});
And this code html:
<form method="get" 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>
When i go to the page, in che console show "{}" and i have not access in the POST variable. how can i solve the problem?
via simone989
No comments:
Post a Comment