Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 3 Here is the main webserver code, named 'index.js': This question is about web application development. You are a middleware developer building a web

image text in transcribed

Question 3 Here is the main webserver code, named 'index.js': This question is about web application development. You are a middleware developer building a web application for a new sports centre called 'Lewisham Fitness', who have a pool and a gym. The centre requires an online form to allow new visitors to the site to sign up for the monthly newsletter. 13. var express - require ('express') 14. var bodyParser= require ('body-parser') You have written a node.js script with a route that adds data collected from a 'sign-up' form to a new user record in the database. The form looks like this: 16. const. app - ANSWER5 17. const port =8000 \begin{tabular}{|l|} \hline Sign up for our monthly newsletter here: \\ Name: \\ Email: \\ \hline \end{tabular} 18. const db = thysql. createconnection (f 19. host: 'localhost', user: 'root', 21. password: 'password', 22.3); database: 'ANSNER6' 23. \}): 31. require('./routes/main") (app) ; 32. app.set ('views' ' dirname +/ views' ); 33. app.set('view engine', 'ejs'); 34. app.engine\{'htm1', require('ejs'\}.renderfile\}; The database is called Lewishamfitness and the table is called 'users'. 35. app.1isten \{ANSWER7, Here is the table creation script: 36. Ap.1isten (A)shERT, \begin{tabular}{l} CREATE TABLE USers ( \\ userid INT ZUTOCINCREMENT, \\ nare V VARHAR (255), \\ email VARCHAR (255) \\ \hline ; \end{tabular} a) What are the missing code statements? [7 marks] Here is your code for the route handler in main.js: i. ANSWER1 ii. ANSWER2 iii. ANSWER3 iv. ANSWER4 v. ANSWERS vi. ANSWERG vii. ANSWER7

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Database Systems Design Implementation And Project Management

Authors: Albert K.W. Yeung, G. Brent Hall

1st Edition

1402053932, 978-1402053931

More Books

Students also viewed these Databases questions