Call/WhatsApp/Text: +44 20 3289 5183

Question: ReSTFul Web Services: A web service is a collection protocols and standards used for exchanging data between applications or systems.

29 Nov 2022,1:32 AM

 

ReSTFul Web Services

 

A web service is a collection protocols and standards used for exchanging data between applications or systems. Services are written in various programming languages, and running on various platforms. The following table has URI examples on how to call the services.

 

Routing Table

 

With ExpressJS, you can easily create a ReStful web services.

 

Here is an example how to create a routing table similar to the one above

 

/*

 

// This application to demo the use of restfull services

 

// This is the core for any MV* pattern

 

// let me know if you have any question

 

// use express server, it must be in the node_modules

 

save this code as wk4_myserver.js in c:\ENTD261

 

to run this code, make sure you are on c:\entd261 if not change directory to c:\entd261

 

>cd c:\entd261

 

C:\ENTD261>node wk4_myserver.js

 

once the server is running, you will get

 

Express server listening on port 55555

 

from any browser

 

http://localhost:55555/

 

*/

 

// setup

 

var express=require("express");

 

var http=require("http");

 

var app=express();

 

// run the server

 

http.createServer(app).listen(55555);

 

console.log('Express server listening on port 55555');

 

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

 

var products = [

 

{ id: 0, name: 'watch', description: 'Tell time with this amazing watch', price: 30.00 },

 

{ id: 1, name: 'sandals', description: 'Walk in comfort with these sandals', price: 10.00 },

 

{ id: 2, name: 'sunglasses', description: 'Protect your eyes in style', price: 25.00 }

 

];

Expert answer

 

This Question Hasn’t Been Answered Yet! Do You Want an Accurate, Detailed, and Original Model Answer for This Question?

 

Ask an expert

Stuck Looking For A Model Original Answer To This Or Any Other
Question?


Related Questions

What Clients Say About Us

WhatsApp us