Hi.
Do you have any ideas how can I make my server to take the NAME of the user from a request URL and user’s AGE from URL query string in Node?
After pressing continue the server should say ‘Hi + name of user’ and also decide if he’s under age to continue or not. Thanks for any help.
Here’s my JS:
var express = require(“express”);
//use the application off of express.
var app = express();
//define the route for “/”
app.get("/", function (request, response){
response.sendFile(__dirname+"/home.html");
app.listen(3000);
console.log(“Server listening on http://localhost:3000”);
And my HTML:
Simple hello world .prompt { font-size: 16px; color: brown; font-weight: bold; margin-bottom: 5px; } .container { width: 50%; } .left-pane { width: 50%; float: left; } .right-pane { width: 50%; float: right; } .submit-name { clear: both; }Hello Node JS
<form method='GET' action="/getemail">
<div class="container">
<div class="prompt left-pane">
<span>Give us your firstname and get email address</span>
</div>
<div class="right-pane">
<input type="text" id="firstname" name="firstname" />
</div>
</div>
<div class="submit-name">
<input type="submit" value="get the email" />
</div>
</div>
</form>