const moviesPostersUrl = await Promise.all(movies.map(movie => getPostUrl(movie)));
const getPosterUrl2 = async movies => {
for (let i = 0; i < movies.length; i++) {
try {
const html = await request.get(movies[i].urlDescription);
const $ = await cheerio.load(html);
movies[i].posterUrl =
"https://www.imdb.com" + $("div.poster > a").attr("href");
console.log(movies[i]);
} catch (error) {
console.log(error);
}
}
return movies;
};
const promisemovies = movies.map(async movie => getPostUrl(movie));
const fastify = require('fastify')()
const findUser = () => {
const users = []
for (let i = 0; i < 100000; i++) {
const user = {
id: i,
name: 'ololo'
}
users.push(user)
}
return users.length
}
fastify.get('/', (req, res) => {
const user = findUser()
res.send({ user })
})
fastify.listen('4040', () => console.log('run'))
func findUser() int {
users := make([]user, 100000)
for i := 0; i < 100000; i++ {
users[i].ID = i
users[i].Name = "ololo"
}
return len(users)
}