-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
51 lines (47 loc) · 1.32 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import express from "express";
import {
macysSelectProducts,
configBrowser,
configLoginData,
} from "./macys.js";
const app = express();
const port = 3000;
app.get("/session/:id", async (req, res) => {
const id = req.params.id;
const response = await configLoginData({
id,
email: "[email protected]",
password: "yEvP2*+3E#G$77g",
});
if (response?.error) res.json({ error: response?.error });
res.json({ message: "Done for " + id });
});
app.get("/", async (req, res) => {
macysSelectProducts({
userData: {
id: "15705386798",
email: "[email protected]",
password: "yEvP2*+3E#G$77g",
},
products: [
{
url: "https://www.macys.com/shop/product/club-room-cashmere-crew-neck-sweater-created-for-macys?ID=1500400&CategoryID=9559&swatchColor=College%20Red&swatchColor=College%20Red",
color: 3,
size: 1,
},
{
url: "https://www.macys.com/shop/product/alfani-mens-cable-sweater-created-for-macys?ID=14078434&CategoryID=4286&swatchColor=Port",
color: 2,
size: 3,
},
],
});
res.send("Hello World!");
});
app.get("/browser", async (req, res) => {
configBrowser({ id: "15705386798" });
res.send("Open browser Done!");
});
app.listen(port, () => {
console.log(`App listening on port ${port}`);
});