Question

Using repl.it, use the Express framework to host a Cloud Security Conference Signup page. A static...

Using repl.it, use the Express framework to host a Cloud Security Conference Signup page. A static HTML page that uses a form to ask the user for his email and name should be created in the public folder. On submit your application should display a message saying “Thank you for registering NAME, we will send you updates on EMAIL”. If the email provided is not valid (doesn’t have the @ character) then display an error message to him.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

// install express validator (server.js)

npm install express-validator

//The Express JS and Node JS Code

var express = require('express');

var bodyparser = require('body-parse');

var app = express();

app.set('view engine', 'ejs');

app.use(bodyParser.json());

app.use(bodyParser.urlencoded({ extended: false }));

//The HTML form(login.js)

app.get('/signup',function(req,res){

res.write('<html>');

res.write('<form action="http://localhost:3000/CloudSecuritySignUp" method="POST">');

res.write('<input type="email" name="email" placeholder="Enter Email"> <br>');

res.write('<input type="text" name="name" placeholder="Enter Name"> <br>');

res.write('<button type="submit">Create New </button><br>');

res.write('</form>');

res.write('</html>');

});


//Submit Operation(loginApp.js)

app.post('CloudSecuritySignUp',function(req,res){

// code to store the Email and Name to Public folder and show the sucess or error alerts

const fs = require('fs');


const { check, validationResult } = require('express-validator');

var Email = request.body.email;

var Name = request.body.name;

//Validating the Email

check('email').isEmail(),

errors = validationResult(req)

if (!errors.isEmpty()) {

response.send('The email you have entered is not valid, please register with a valid email address');

}

//writing the varaibles to a file of public folder

fs.writeFileSync('/publicFolder/registration.txt',Email,Name);

response.send('Thank you for registering NAME, we will send you updates on EMAIL');

}

Add a comment
Know the answer?
Add Answer to:
Using repl.it, use the Express framework to host a Cloud Security Conference Signup page. A static...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • URGENT HELP NEEDED: JQuery. PLEASE POST SCREEN SHOTS Task 1: Downloading jQuery Right-click the link to...

    URGENT HELP NEEDED: JQuery. PLEASE POST SCREEN SHOTS Task 1: Downloading jQuery Right-click the link to download the uncompressed latest version of jQuery Copy the jQuery.x.x.x.js file in the folder and specified as source file. Task 2: Download and install HTML-Kit 1. Navigate to htmlkit.com. 2. Click Download HTML-Kit 292. After it downloads, launch HKSetup.exe. Choose Full installation (the default) Uncheck Yes, download and install HTML-Kit Tools Trial. 6. Click Next>Finish. Task 3: Creating a Simple jQuery Application Launch HTML-Kit....

  • For milestone #1, we will start the CARIT site with three static HTML pages and a...

    For milestone #1, we will start the CARIT site with three static HTML pages and a CSS file. Create a dedicated folder for this project. This folder should contain all related files in this project. The future milestones are cumulative and built directly on top of your prior work. Function/content requirements: A home page named “index.html”, which include these contents at least: Description of the center. You may reference the example sites. Latest news: use list tags; make up some...

  • Risk management in Information Security today Everyday information security professionals are bombarded with marketing messages around...

    Risk management in Information Security today Everyday information security professionals are bombarded with marketing messages around risk and threat management, fostering an environment in which objectives seem clear: manage risk, manage threat, stop attacks, identify attackers. These objectives aren't wrong, but they are fundamentally misleading.In this session we'll examine the state of the information security industry in order to understand how the current climate fails to address the true needs of the business. We'll use those lessons as a foundation...

  • And there was a buy-sell arrangement which laid out the conditions under which either shareholder could...

    And there was a buy-sell arrangement which laid out the conditions under which either shareholder could buy out the other. Paul knew that this offer would strengthen his financial picture…but did he really want a partner?It was going to be a long night. read the case study above and answer this question what would you do if you were Paul with regards to financing, and why? ntroductloh Paul McTaggart sat at his desk. Behind him, the computer screen flickered with...

  • TORENTO CONSTRUCTION: ETHICAL CONTRACTING On December 27, 2010, Cary Holmes, manager of the Supply Chain Management...

    TORENTO CONSTRUCTION: ETHICAL CONTRACTING On December 27, 2010, Cary Holmes, manager of the Supply Chain Management (SCM) group at Torento Construction Inc. (NCG), was in his office in Torento, Ontario, trying to organize the thoughts running through his head as a result of a recent bidding to save operating costs at NCG. There was no problem in terms of the final outcome; in fact, the bid was going to result in cost savings of 25 per cent, which was exactly...

  • CASE 8 Unlocking the Secrets of the Apple iPhone in the Name of access the male...

    CASE 8 Unlocking the Secrets of the Apple iPhone in the Name of access the male San Bernardino suspect's iPhone 5c. Cook stated: Antiterrorism We are challenging the FBI's demands with the deepes respect for American democracy and a love of our country. We believe it would be in the best interest of everyone to step back and consider the implications While we believe the FBI's intentions are good, if would be wrong for the w e nt to force...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT