Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I'm having a really hard time getting started on these four functions can someone please help me? Javascript please! There is comments on what the

I'm having a really hard time getting started on these four functions can someone please help me? Javascript please!

There is comments on what the functions have to do. Can someone please implement the four functions?

The front end will be developed using HTML and Javascript and the back end is built using Node.js framework.

The back end is a REST service with four functions.

image text in transcribed

31 32 33 34 35 app.get('/contents', (request, response) => { // TODO: this function should return the list of the themes of the dictionary // Each these has an id and a name. The id is a number. Each theme has a unique id. // This function should return a json string. }); 36 37 40 41 app.get('/pages/:contentId', (request, response) => { // TODO: this function should return the list of the ids of // the images that are associated with the theme whose id is equal to contentId. // Each image has an id and a name. The id is a number and the name is a // string that also includes the extention of the image. // The id of an image is unique for the theme associated with the image and not globally. // An image is associated with one and only one theme. // associated with the theme that is identified by contnetid. // This function should return a json string. }); 43 44 45 46 49 50 51 52 53 app.get('/pages/:contentId/image/:imageId", (request, response) => {/ // TODO: If the theme(contentId) has an image with the id 'imageId", // then this function should return the image. // Otherwise this function should return a HTTP 404 respone. }); 54 55 59 app.get('/words/:contentId/:imageId/:objectX/:objectY', (request, response) => { // TODO: Each image contains one or more objects. // Some of these objects are marked with a number. // This function returns the word associated with the object that is // identified with the X and Y coordination. // A word has an id, a name and X and Y coordinations. The id of a word is unique for // the image associated with the word and not globally. // Also there can be two words with the same name but different ids because // there are words that have several different meanings. }); 61 62 63 64 31 32 33 34 35 app.get('/contents', (request, response) => { // TODO: this function should return the list of the themes of the dictionary // Each these has an id and a name. The id is a number. Each theme has a unique id. // This function should return a json string. }); 36 37 40 41 app.get('/pages/:contentId', (request, response) => { // TODO: this function should return the list of the ids of // the images that are associated with the theme whose id is equal to contentId. // Each image has an id and a name. The id is a number and the name is a // string that also includes the extention of the image. // The id of an image is unique for the theme associated with the image and not globally. // An image is associated with one and only one theme. // associated with the theme that is identified by contnetid. // This function should return a json string. }); 43 44 45 46 49 50 51 52 53 app.get('/pages/:contentId/image/:imageId", (request, response) => {/ // TODO: If the theme(contentId) has an image with the id 'imageId", // then this function should return the image. // Otherwise this function should return a HTTP 404 respone. }); 54 55 59 app.get('/words/:contentId/:imageId/:objectX/:objectY', (request, response) => { // TODO: Each image contains one or more objects. // Some of these objects are marked with a number. // This function returns the word associated with the object that is // identified with the X and Y coordination. // A word has an id, a name and X and Y coordinations. The id of a word is unique for // the image associated with the word and not globally. // Also there can be two words with the same name but different ids because // there are words that have several different meanings. }); 61 62 63 64

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

Step: 3

blur-text-image

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

Database Security

Authors: Alfred Basta, Melissa Zgola

1st Edition

1435453905, 978-1435453906

More Books

Students also viewed these Databases questions

Question

What actions or changes in policy do you suggest for Caterpillar?

Answered: 1 week ago

Question

a. Did you express your anger verbally? Physically?

Answered: 1 week ago