Question

In: Computer Science

I need to have someone design a website using Code one JavaScript server application using Node.js...

I need to have someone design a website using

  • Code one JavaScript server application using Node.js for routing, Express.jsfor framework and Handlebars.js for templating
  • Necessary npm modules are: express, express-handlebars, path and body-parser

- it willl have a drop down box with 5 names of titles of a picture.

- highlite 1 name in dropdown box and there is a select button to make web site go to that picture stored on server..

this is my third question on this site and i have yet to receive any help. so I really need help on this now because i am so far behind

Solutions

Expert Solution

/* So we will use express to design you website, follow step by step instructions of given below steps

So first generate app using "express --view=hbs appname" command( i hope you have every related package installed), now inside app run "npm i" to install related packages .now run npm start (You will see server running at localhost:3000

Now open views/index.hbs and copy paste following code

*/

index.hbs

<form>

<select id="img" value="">

    <option value="">Select...</option>

    <option value="/first">Paradise</option>

    <option value="/second">Coldplay</option>

    <option value="/third">Paradise1</option>

    <option value="/fourth">Coldplay2</option>

    <option value="/fifth">Coldplay2</option>

</select>

<button type="button" onclick="myfunc()">Submit</button>

</form>

<script>

function myfunc(){

var j=document.getElementById("img").value;

window.location=j;

}

</script>

/*Now in app.js add following line */

app.use(express.static('public'));

/* In the routes folder open index.js */

index.js

var express = require('express');

var router = express.Router();

/* GET home page. */

router.get('/', function(req, res, next) {

  res.render('index');

});

router.get('/first', function(req, res, next) {

  res.render('images',{path:'pardeep.png'});

});

router.get('/second', function(req, res, next) {

  res.render('images',{path:'pardeep.png'});

});

router.get('/third', function(req, res, next) {

  res.render('images',{path:'pardeep.png'});

});

router.get('/fourth', function(req, res, next) {

  res.render('images',{path:'pardeep.png'});

});

router.get('/fifth', function(req, res, next) {

  res.render('images',{path:'pardeep.png'});

});

module.exports = router;

/* Now create file inside views folder as images.hbs */

images.hbs

<img src="/images/{{path}}"/>

/*You can change url of images, if you select any field you will se you will be taken to specific page */

/* Feel free to ask any doubt in commenst */

C INeed To Have Someone Design Express X localhost:3000 Select Select Paradise Coldplay 23:59 ^ D ) ENG 05-10-2019 Type here to search e3 O


Related Solutions

Using node.js, create the following tasks. 1. Set up a server and HTML file server as...
Using node.js, create the following tasks. 1. Set up a server and HTML file server as shown in the videos. Once you have it successfully running, make the following adjustments A. When a 404 error (file not found) occurs, display a funny message about the file missing and/or did you forget how to type? B. If the user enters a request for the home page (index.html) then: Display an index.html page you have created which includes your name, course number,...
I need to design and implement a JAVASCRIPT program that will allow us to determine the...
I need to design and implement a JAVASCRIPT program that will allow us to determine the length of time needed to pay off a credit card balance, as well as the total interest paid. The program must implement the following functions: displayWelcome This function should display the welcome message to the user explaining what the program does. calculateMinimumPayment This function calculates the minimum payment. It should take balance and minimum payment rate as arguments and return the minimum payment. So...
Write a simple javascript program using express and node.js to create a simple webpage that can...
Write a simple javascript program using express and node.js to create a simple webpage that can lead to other pages within the program. if possible, Comment everything out so I could understand how every things works.  But basically, server should be hosted on localhost:8000 and should have a simple starting page. Maybe a welcome message, with at least two "links" that goes to a "homepage" and then a "exit" page.
i need code in javascript or htmlt convert 0 to 999 numbers into word
i need code in javascript or htmlt convert 0 to 999 numbers into word
Using HTML/Javascript (if needed) I want to create a table for a website that pulls data...
Using HTML/Javascript (if needed) I want to create a table for a website that pulls data from another website where the data is being updated on. Example: https://investors.coca-colacompany.com/stock-information/historical-data I cannot just put in the numbers to a table as they will be getting updated daily. So it needs to link the the website elements. DATE OPEN HIGH LOW CLOSE VWAP VOLUME % CHG CHANGE TRADE VAL TOTAL TRADES 2020-10-13 -- -- -- 51.09 -- -- 0.00% -- -- -- 2020-10-12...
Using JavaScript for the following assignment Design and code a function named "intersection" that takes two...
Using JavaScript for the following assignment Design and code a function named "intersection" that takes two arrays of numbers in parameter and returns a new array containing only the values that are both in the two arrays. A value must not be found more than once in the resulting array but can be found more than once in the arrays in parameter. The order of the elements in the resulting array must respect the order of the first parameter. For...
You need to design a Web Server, Database Server and a Backup server. If you had...
You need to design a Web Server, Database Server and a Backup server. If you had to choose from the following list of resources which ones would you place a priority on and state why you would do so. List these for each server type. Hint: You need to think about the functionality of the server. Based on this information, which resource would you emphasize on the most to increase the performance of the server. CPU utilization and speed Multiprocessing...
I am working on an assignment using SQL Server Management and I need to print an...
I am working on an assignment using SQL Server Management and I need to print an ERD to a single page as a PDF file. I am not sure how to do this especially because the diagram is rather large... I am using SQL Server Management Studio I have created an Entity relationship diagram for AdventureWorks that includes all product tables. There are many tables.How do I print it to a single page?
PLEASE USE THE FLOWORITHM APPLICATION FOR THE ANSWER . I need that not a flowchart .Design...
PLEASE USE THE FLOWORITHM APPLICATION FOR THE ANSWER . I need that not a flowchart .Design the logic for a program that takes in three numbers from the user. Find the largest of the three numbers and output the largest number.
what will be the code in C programming for the client and server chat application for...
what will be the code in C programming for the client and server chat application for the below issue :- write the C Programming code that able client have a unique ID to be known by the server
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT