Create webpages that can do the following: 1. Let a user input name, email addre
ID: 3607051 • Letter: C
Question
Create webpages that can do the following:
1. Let a user input name, email address. Post to the server
2. List index of all users
3. List information about a particular user
Also,
Build a node/express server to navigate among these pages
– Routes can be fixed for now
– Use bootstrap, handlebars
Here is what I have so far for my node.js server:
// require our dependencies
var express = require('express');
var bodyParser = require('body-parser');
var app = express();
var port = process.env.PORT || 8080;
// use body parser
app.use(bodyParser.urlencoded({ extended: true }));
// route our app
var router = require('routes');
app.use('/', router);
// set static files (css and images, etc) location
app.post('/myaction', function(req, res) {
res.send('You sent the name "' + req.body.name + '".');
});
app.listen(8080, function() {
console.log('Server running at http://127.0.0.1:8080/');
});
Here is what I have so far for one of my webpages, index.html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>INFX 371 Assignment 1</title>
</head>
<body>
<form action="http://127.0.0.1:8080/myaction" method="post">
<fieldset>
<legend>Please Submit Your Information:</legend>
<ul>
<li>
<strong>Name:</strong>
<input type="text" name="username" size="25" />
</li>
<br />
<li>
<strong>Email Address:</strong>
<input type="text" name="email" size="40" />
</li>
</ul>
<input type="submit" value="Submit">
</fieldset>
</form>
</body>
</html>
Explanation / Answer
Skip to content /trending Sign in or Sign upRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.