i am using Express & Ejs & body-parser ; Server js:
app.post('/', function(req, res) {
if (!req.body) return res.sendStatus(400)
console.log(req.body)
});
My Index.Ejs File
<div class="container">
<fieldset>
<form action="/" method="post">
<input name="city" type="text" class="ghost-input" placeholder="Enter a City" required>
<input type="submit" class="ghost-button" value="Get Weather">
</form>
</fieldset>
</div>
i get this Error in console:-
Cannot set headers after they are sent to client