Trying to create a script that will collect data from API and as soon it finished gathering data from the first page it must navigate to the second page.
Tried this
module.exports = async function (app, pool, fetch) {
app.get('/getdata123/', async function (req, res) {
const category_title = ['users', 'unknown'];
let urlApart = 'https://reqres.in/api/'; //url of page
let url = urlApart + category_title ;
console.log (url);
});
}
and it returned the "https://reqres.in/api/users,unknown"
I want something like "https://reqres.in/api/users" than script collected needed data and moved to "https://reqres.in/api/unknown" to collect the same parameters on second page
You can map over category_title and it'll give you [ "https://reqres.in/api/users", "https://reqres.in/api/unknown"] which you could then use to achieve your end goal.
const category_titles = ['users', 'unknown'].map(title => `https://reqres.in/api/${title}`);