E
E
Evgeniya2021-07-13 04:05:07
Express.js
Evgeniya, 2021-07-13 04:05:07

How to send the result of a GET request in a POST request?

please tell me with the following task:
Create an Express.js server with 2 routes:

POST /upload/dog/image: generates a random animal image via the API https://random.dog/woof.json (may return videos - you need them skip) changes the size of the image with the parameters received in the resize request saves the info to the database

GET /list/dog/images accepts parameters for searching (filtering) and returns all the images that match them

I can’t figure out how to build a POST request in this case, it turns out that it should contain a GET request for API https://random.dog/woof.json ? This API returns json of this format { "fileSizeBytes": 269683, "url": "https://random.dog/722a1a47-9a41-454f-bc65-8cb6c96... " } that is, as I understand it, you need to extract the url and send it in a post request. And also what does it mean resizes the image with those received in the request resize parameters and in the GET request what are the search parameters and where to get them from?Please help me.In TK I use Typescript (I do it in two versions - from scratch and using NestJs), MongoDb base.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question