I want to use form input from HTML to JS. For that i am using following snippet but getting "SyntaxError: Unexpected token if" can anyone help in modifying it.
var http = require('http');
var url = require('url');
var fs = require('fs');
http.createServer(function(req, res) {
    fs.readFile(html_form_path, function(err, data) {
        res.writeHead(200, {'Content-Type': 'text/html'});
        res.write(data);
        res.end();
    });
    var q = url.parse(req.url, true);
    var qdata = q.query;
    res.write(qdata.Input());
}).listen(8080);
HTML FORM:
<html>
<body>
    <form type='get'>
        <input type="text" name='Input'>
        <input type='submit'>
    </form>
</body>
</html>
 
     
    