feat: Introduce Dockerization and shift product data sourcing from external API to local files.
This commit is contained in:
7
Dockerfile
Normal file
7
Dockerfile
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
FROM node:22-alpine
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
CMD ["node", "index.js"]
|
||||||
9
index.js
9
index.js
@@ -60,13 +60,10 @@ async function compareAndSave(productsPrice) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function getProducts() {
|
async function getProducts() {
|
||||||
const products = await axios
|
const products = fs.readFileSync("input.txt", "utf8");
|
||||||
.get(
|
const productsIds = products.split("\n");
|
||||||
"https://db.maciaszek.ovh/api/collections/gifts_items/records?fields=ceneo_id&filter=ceneo_id!=''"
|
|
||||||
)
|
|
||||||
.then((response) => response.data.items.map((item) => item.ceneo_id));
|
|
||||||
|
|
||||||
return products;
|
return productsIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function init() {
|
async function init() {
|
||||||
|
|||||||
Reference in New Issue
Block a user