ENTD261 Week 4 Introduction: Node.js

Learning Goal: I’m working on a programming exercise and need an explanation and answer to help me learn.

Course name : ENTD261

Week 4: Node.js

Instructions

Create a simple Node.js server (Save as w4_fougnigue_soro.js) . Create a restful application similar to the one in lesson 4 (ReSTFul Web Services). Document the routing table, and the application you created.

Submit your week 4 work in w4_fougnigue_soro.txt (Please save the file as a text file and upload the text file here for final review.)

Note: node MUST be installed in the entd261 folder. Your code must be saved to the entd261 folder. node cannot be installed in any other folder. Be sure you have done this, or the code will not run in the command line.

Please refer to the attached sample solution file, w4_first_lastName.txt, for help. In place of first and lastName in the file name make sure your first and last names are present.

Requirements Points
Comment block. Instructions on how to run the code with examples 20
Code documentation and comments. 10
Assignment code including creating command line /URL parameter

(see routing table on how to document the URLs)

70
TOTAL POINTS 100

Reminder: This is what your ENTD261 folder should look like with node installed.

Attachments

w4_first_lastName.txt

(2.15 KB)

/*******************************************************************

***

***ENTD261

***

***Week 4

*** How to run: node w4_first_lastName.js

*** This Node.js app will display the inventory of a car shop.

***once the server is running, you will get

***Express server listening on port 44444

***from any browser enter http://localhost:44444/

*******************************************************************/

//setup

var express =require (“express”);

var http = require (“http”);

var app = express();

// run the server

app.listen(44444, function(){

console.log(“server is running on port 44444”);

})

// <<< here is the Model, the data storage

var vehicles = [

{id: 0, make: ‘toyota’, model: ‘corola’, year: 2019, color: ‘blue’},

{id: 1, make: ‘jeep’, model: ‘patriot’, year: 2016, color: ‘red’},

{id: 2, make: ‘honda’, model: ‘civic’, year: 2018, color: ‘white’},

{id: 3, make: ‘chevrolet’, model: ‘cruze’, year: 2019, color: ‘silver’}

];

// http://localhost:44444// general route

// here is the refer

app.get(“/”, function(req,res){

var message = “”

message += “<center><h1> Welcome to Pemon’s Car Shop </h1></center>”

message += “<center><h2>use the following </h2></center><br/>”

message += “<center> http://localhost:44444/about_us</center><br>”

message += “<center>http://localhost:44444/vehicles</center><br>”

message += “<center>http://localhost:44444/vehicles/3</center><br>”

res.send(message);

});

// <<< routes = controller

// http://localhost:44444/about_us// about_usroute

app.get(“/about_us”, function(req,res){

res.send(“We are here to serve you”);

});

// http://localhost:44444/vehicles// load and display all vehicles

app.get(‘/vehicles’, function(req, res){

res.send(JSON.stringify(vehicles));

});

// http://localhost:44444/vehicles/3// load and display vehicle id 3

app.get(‘/vehicles/:id’, function(req, res){

if(req.params.id > (vehicles.length -1) || req.params.id < 0){

res.statusCode = 404;

res.end(‘Vehicle Not Found’);

}

res.send(JSON.stringify(vehicles[req.params.id]))

});

Calculate your paper price
Pages (550 words)
Approximate price: -

Why Choose Us

Quality Papers

We value our clients. For this reason, we ensure that each paper is written carefully as per the instructions provided by the client. Our editing team also checks all the papers to ensure that they have been completed as per the expectations.

Professional Academic Writers

Over the years, our Acme Homework has managed to secure the most qualified, reliable and experienced team of writers. The company has also ensured continued training and development of the team members to ensure that it keep up with the rising Academic Trends.

Affordable Prices

Our prices are fairly priced in such a way that ensures affordability. Additionally, you can get a free price quotation by clicking on the "Place Order" button.

On-Time delivery

We pay strict attention on deadlines. For this reason, we ensure that all papers are submitted earlier, even before the deadline indicated by the customer. For this reason, the client can go through the work and review everything.

100% Originality

At Papers Owl, all papers are plagiarism-free as they are written from scratch. We have taken strict measures to ensure that there is no similarity on all papers and that citations are included as per the standards set.

Customer Support 24/7

Our support team is readily available to provide any guidance/help on our platform at any time of the day/night. Feel free to contact us via the Chat window or support email: support@acmehomework.com.

Try it now!

Calculate the price of your order

We'll send you the first draft for approval by at
Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

Papers Owl has stood as the world’s leading custom essay writing services providers. Once you enter all the details in the order form under the place order button, the rest is up to us.

Essays

Essay Writing Services

At Papers Owl, we prioritize on all aspects that bring about a good grade such as impeccable grammar, proper structure, zero-plagiarism and conformance to guidelines. Our experienced team of writers will help you completed your essays and other assignments.

Admissions

Admission and Business Papers

Be assured that you’ll definitely get accepted to the Master’s level program at any university once you enter all the details in the order form. We won’t leave you here; we will also help you secure a good position in your aspired workplace by creating an outstanding resume or portfolio once you place an order.

Editing

Editing and Proofreading

Our skilled editing and writing team will help you restructure you paper, paraphrase, correct grammar and replace plagiarized sections on your paper just on time. The service is geared toward eliminating any mistakes and rather enhancing better quality.

Coursework

Technical papers

We have writers in almost all fields including the most technical fields. You don’t have to worry about the complexity of your paper. Simply enter as much details as possible in the place order section.

error: Content is protected !!