how to run a script with custom values?

My script prints text to the console every second and stops after 4 seconds. I need to make sure that the interval and stop values ​​can be specified when the file is run. The file should be run with this command: node index.js -i 1000 -t 4000. How can i do this? app.get(“/”, (req, res)… Read More how to run a script with custom values?

Changing date value in object in Node

For example i have a get request which takes some data from mongo db: const getAllContracts = async (req, res) => { const contracts = await Contract.find({}); res.status(StatusCodes.OK).json({ contracts, count: contracts.length }); }; As response it sends: { "contracts": [ { "_id": "637cbd3279de1dd12dd7d2f9", "tenant": "Nazar", "manager": "Misha", "object": "Автовокзал", "price": 99, "area": 335, "status": "Активний",… Read More Changing date value in object in Node

Which method would be more appropriate here POST or PATCH?

Let’s say I have a db collection with users and I want to ADD an object to an array inside one document. It was like this: { _id: "636e8e1dd710eed71565741c", username: "test", password: "$2b$10$/s9.kRYSax380Xrxf3xyVO9Z6Otc/WVx5kBSLKfu43/wYP.TSnzvW", tasks: [{name: task1, status: "finished"}] } And I am going to make it look like this: { _id: "636e8e1dd710eed71565741c", username: "test", password:… Read More Which method would be more appropriate here POST or PATCH?