Skip to content

Commit

Permalink
ultimos cambios
Browse files Browse the repository at this point in the history
  • Loading branch information
Víctor Escalera García committed Mar 17, 2024
1 parent 854fd9e commit 8e223d7
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 1,026 deletions.
8 changes: 4 additions & 4 deletions Victor/api-VEG.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = (app, db) => {

//Documentación Postman
app.get(API_BASE + "/youtube-trends/docs", (req, res) => {
res.status(301).redirect("https://documenter.getpostman.com/view/33038536/2sA2xh3Cti")
res.status(301).redirect("https://documenter.getpostman.com/view/33038536/2sA2xnxpcY")
});

//GET Punto 13: Introducir datos
Expand Down Expand Up @@ -91,16 +91,16 @@ module.exports = (app, db) => {
});
});

//D01: GET para obtener un recurso por title y channel_title y published_at
//D01: GET para obtener un recurso por title, channel_title y published_at
app.get(API_BASE + "/youtube-trends/:title/:channel_title/:published_at", (req, res) => {
const title = req.params.title;
const channelTitle = req.params.channel_title;
const publishedAt = req.params.published_at;
const publishedAt = req.params.published_at; // Cambio de req.params a req.query

let query = {
title: title,
channel_title: channelTitle,
published_at: publishedAt
published_at: publishedAt
};

db.findOne(query).exec((err, resource) => {
Expand Down
2 changes: 1 addition & 1 deletion Victor/index-VEG.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const paisDeseado = 'Albania';
// Calcular la media de view_count para el país deseado
const mediaViewCountPaisDeseado = calcularMediaViewCount(data, paisDeseado);

console.log(`La media de view_count para ${paisDeseado} es: ${mediaViewCountPaisDeseado}`);
//console.log(`La media de view_count para ${paisDeseado} es: ${mediaViewCountPaisDeseado}`);

module.exports = data;

16 changes: 12 additions & 4 deletions tests/apiVEG-gcloud.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,14 @@
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"// Verificar que la respuesta sea un objeto\r",
"pm.test(\"La respuesta debe ser un objeto\", function () {\r",
" // Convertir el cuerpo de la respuesta JSON a un objeto\r",
" var jsonData = pm.response.json();\r",
"\r",
" // Verificar si el cuerpo de la respuesta es un objeto\r",
" pm.expect(jsonData).to.be.an('object');\r",
"});"
],
"type": "text/javascript",
Expand All @@ -136,17 +144,17 @@
"method": "GET",
"header": [],
"url": {
"raw": "{{gcloud}}/api/v1/youtube-trends/España campeona del mundo/SEFutbol/2010-07-011T22:00:12Z",
"raw": "{{gcloud}}/api/v1/youtube-trends/DON XHONI - KATILE/DON XHONI/2022-07-07T22:00:12Z",
"host": [
"{{gcloud}}"
],
"path": [
"api",
"v1",
"youtube-trends",
"España campeona del mundo",
"SEFutbol",
"2010-07-011T22:00:12Z"
"DON XHONI - KATILE",
"DON XHONI",
"2022-07-07T22:00:12Z"
]
}
},
Expand Down
Loading

0 comments on commit 8e223d7

Please sign in to comment.