my-project stubs #4

Merged
primakov merged 2 commits from my into master 2024-05-25 12:50:20 +03:00
4 changed files with 262 additions and 0 deletions

View File

@ -56,6 +56,7 @@ app.use('/example', require('./routers/example'))
// app.use('/car-wash', require('./routers/car-wash'))
app.use('/zoom-bar', require('./routers/zoom-bar'))
app.use('/r-and-m', require('./routers/r-and-m'))
app.use('/my', require('./routers/my'))
app.use('/edateam', require('./routers/edateam'))
app.use('/webstar-project', require('./routers/webstar-project'))
//app.use('/basket', require('./routers/basket'))

View File

@ -0,0 +1,30 @@
const router = require('express').Router();
router.get('/catalog-data', (request, response) => {
response.send(require('./stubs/json/catalog-data/success.json'))
})
router.get('/item-data', (request, response) => {
response.send(require('./stubs/json/catalog-data/newsuccess.json'))
})
router.post('/search', (request, response) => {
const searchTerm = request.body.search.toLowerCase();
try {
const itemsData = require('./stubs/json/catalog-data/newsuccess.json');
const itemData = itemsData.data.find(item => item.name.toLowerCase().includes(searchTerm));
if (itemData) {
return response.json({ data: itemData });
} else {
console.log('Item not found');
return response.status(404).send('Item not found');
}
} catch (error) {
console.error('Error reading file:', error);
return response.status(500).send('Internal server error');
}
});
module.exports = router;

View File

@ -0,0 +1,52 @@
{
"data":[
[{
"id": 1,
"photo": "shirt7_1x",
"alt" :"ФУТБОЛКА 'ЧЕРНОЕ МОРЕ'",
"name": "ФУТБОЛКА 'ЧЕРНОЕ МОРЕ'",
"price": "1500 руб.",
"setphoto": ["shirt7_1x","shirt7_2x","shirt7_4x"]
},
{
"id":2,
"photo": "shirt8_1x",
"alt" :"ЗИП МУЖСКОЙ",
"name": "ЗИП МУЖСКОЙ",
"price": "1500 руб.",
"setphoto": ["shirt8_1x","shirt8_2x","shirt8_4x"]
},
{
"id": 3,
"photo": "shirt1_1x",
"alt" :"Фотография футболки белого цвета с цитатой из К/ф Кавказская пленница",
"name": "ФУТБОЛКА С ПРИНТОМ МОСФИЛЬМ",
"price": "1500 руб.",
"setphoto": ["shirt1_1x","shirt1_2x","shirt1_4x"]
}],
[{
"id": 4,
"photo": "shirt9_1x",
"alt" :"ЛАВАНДОВОЕ ХУДИ",
"name": "ЛАВАНДОВОЕ ХУДИ",
"price": "1500 руб.",
"setphoto": ["shirt9_1x","shirt9_2x","shirt9_4x"]
},
{
"id": 5,
"photo": "shirt10_1x",
"alt" :"ФУТБОЛКА АНИМЕ",
"name": "ФУТБОЛКА АНИМЕ",
"price": "1500 руб.",
"setphoto": ["shirt10_1x","shirt10_2x","shirt10_4x"]
},
{
"id": 6,
"photo":"shirt11_1x",
"alt" :"ФУТБОЛКА ОВЕРСАЙЗ С ПРИНТОМ ЭРАРТА",
"name": "ФУТБОЛКА ОВЕРСАЙЗ С ПРИНТОМ ЭРАРТА",
"price": "1500 руб.",
"setphoto": ["shirt11_1x","shirt11_2x", "shirt11_4x"]
}]
]
}

View File

@ -0,0 +1,179 @@
{
"data":[
{
"id": 1,
"photo": ["shirt7_1x", "shirt7_1_1x"],
"alt" :"ФУТБОЛКА 'ЧЕРНОЕ МОРЕ'",
"name": "ФУТБОЛКА 'ЧЕРНОЕ МОРЕ'",
"price": "1500 руб.",
"color" : "Серый",
"colorid" : 7,
"colorcss": ["#606060","#FFFFFF"],
"setphoto": ["shirt7_1x","shirt7_1_1x","shirt7_2x","shirt7_1_2x", "shirt7_4x", "shirt7_1_4x"],
"size": ["XS/S","M/L","XL/XLL"],
"body": ["79653",
"Весна-Лето 2023",
"Черное море",
"без застежки",
"светло-серый",
"100% Хлопок",
"свободный",
"картина",
"удлиненная",
"101-78-96",
"178",
"M (48)",
"без карманов",
"160",
"Женский"]
},
{
"id":2,
"photo": ["shirt8_1x", "shirt8_1_1x"],
"alt" :"ЗИП МУЖСКОЙ",
"name": "ЗИП МУЖСКОЙ",
"price": "1500 руб.",
"setphoto": ["shirt8_1x","shirt8_1_1x","shirt8_2x","shirt8_1_2x", "shirt8_4x", "shirt8_1_4x"],
"size": ["XS/S","M/L","XL/XLL"],
"body": ["7934",
"Весна-Осень 2023",
"Третьяковская галерея",
"с застежкой",
"черный",
"100% Хлопок",
"свободный",
"надпись",
"удлиненная",
"90-80-96",
"182",
"L (50)",
"с карманами",
"160",
"Мужской"]
},
{
"id": 3,
"photo": ["shirt1_1x", "shirt1_1_1x"],
"alt" :"Фотография футболки белого цвета с цитатой из К/ф Кавказская пленница",
"name": "Футболка с принтом Мосфильм",
"price": "1500 руб.",
"setphoto": ["shirt1_1x","shirt1_1_1x","shirt1_2x","shirt1_1_2x", "shirt1_4x", "shirt1_1_4x"],
"size": ["XS/S","M/L","XL/XLL"],
"body": ["79776",
"Весна-Лето 2021",
"Третьяковская галерея",
"без застежки",
"темно-серый",
"100% Хлопок",
"свободный",
"надписи",
"удлиненная",
"101-78-96",
"189",
"L (50)",
"без карманов",
"160",
"Женский"]
},
{
"id": 4,
"photo": ["shirt9_1x", "shirt9.1_1x"],
"alt" :"ЛАВАНДОВОЕ ХУДИ",
"name": "ЛАВАНДОВОЕ ХУДИ",
"price": "1500 руб.",
"setphoto": ["shirt9_1x","shirt9.1_1x","shirt9_2x","shirt9.1_2x", "shirt9_4x", "shirt9.1_4x"],
"size": ["XS/S","M/L","XL/XLL"],
"body": ["79276",
"Весна-Лето 2021",
"Третьяковская галерея",
"без застежки",
"лавандовы",
"100% Хлопок",
"свободный",
"надписи",
"удлиненная",
"101-78-96",
"184",
"L (50)",
"с карманами",
"160",
"Женский"]
},
{
"id": 5,
"photo": ["shirt10_1x", "shirt10.1_1x"],
"alt" :"ФУТБОЛКА АНИМЕ",
"name": "ФУТБОЛКА АНИМА",
"price": "1500 руб.",
"setphoto": ["shirt10_1x","shirt10.1_1x","shirt10_2x","shirt10.1_2x", "shirt10_4x", "shirt10.1_4x"],
"size": ["XS/S","M/L","XL/XLL"],
"body": ["79276",
"Лето 2024",
"Третьяковская галерея",
"без застежки",
"фистошковый",
"100% Хлопок",
"свободный",
"картина",
"удлиненная",
"101-78-96",
"189",
"L (50)",
"без карманов",
"160",
"Мужской"]
},
{
"id": 6,
"photo": ["shirt11_1x", "shirt11.1_1x"],
"alt" :"ФУТБОЛКА ОВЕРСАЙЗ С ПРИНТОМ ЭРАРТА",
"name": "ФУТБОЛКА ОВЕРСАЙЗ С ПРИНТОМ ЭРАРТА",
"price": "1500 руб.",
"setphoto": ["shirt11_1x","shirt11.1_1x","shirt11_2x","shirt11.1_2x", "shirt11_4x", "shirt11.1_4x"],
"size": ["XS/S","M/L","XL/XLL"],
"body": ["79276",
"Лето 2024",
"Третьяковская галерея",
"без застежки",
"черный",
"100% Хлопок",
"свободный",
"картина",
"удлиненная",
"101-78-96",
"189",
"L (50)",
"без карманов",
"160",
"Женский"]
},
{
"id": 7,
"photo": ["shirt7_1x", "shirt7_1_1x"],
"alt" :"ФУТБОЛКА 'ЧЕРНОЕ МОРЕ'",
"name": "ФУТБОЛКА 'ЧЕРНОЕ МОРЕ'",
"price": "1500 руб.",
"color" : "Белый",
"colorid" : 1,
"colorcss": ["#606060","#FFFFFF"],
"setphoto": ["shirt7_1x","shirt7_1_1x","shirt7_2x","shirt7_1_2x", "shirt7_4x", "shirt7_1_4x"],
"size": ["XS/S","M/L","XL/XLL"],
"body": ["79653",
"Весна-Лето 2023",
"Черное море",
"без застежки",
"светло-серый",
"100% Хлопок",
"свободный",
"картина",
"удлиненная",
"101-78-96",
"178",
"M (48)",
"без карманов",
"160",
"Женский"]
}
]
}