<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<textarea id="area" cols="100" rows="50"></textarea>
<script>
var doc = {
"_id": "5b1055bab772d4a8c93dc0cf",
"name": "sendPhotoRemovePush",
"titleEn": "Photo deleted (No face)",
"titleRu": "Фото удалено (Без лица)",
"bodyEn": "Upload your photo with a face. Your profile will be deleted with in 24 hours",
"bodyRu": "Загрузите своё фото с лицом. Ваш профиль будет удалён в течении 24 часа",
"sound": "obyjvlenie.mp3",
"createdAt": "2018-05-31T21:02:39.547Z",
"updatedAt": "2018-06-01T07:09:29.791Z"
}
area.value = JSON.stringify(doc, null, 4);
</script>
</body>
</html>
module.exports = async function имя1(params) {
try {
const response = await request(params);
let charset = [];
charset.name = response.data;
const charsetResult = await someFunc(charset);
if (charsetResult.value === undefined) {
charsetResult.value = 'PR10';
} else {
charsetResult.guild = charset.guild.name;
}
return charsetResult;
} catch (error) {
console.log(error);
};
}
router.get('/', (req, res) => {
Order.find()
.then(orders => {
res.render('user', {
username: req.user.username,
title: 'Главная страница',
order: orders
});
})
.catch(error => {
console.log(error);
})
/* Вариант с калбеком
Order.find((error, orders) => {
if (error) {
console.log(error);
}
res.render('user', {
username: req.user.username,
title: 'Главная страница',
order: orders
});
})*/
});
router.get('/', async (req, res) => {
try {
const orders = await Order.find();
res.render('user', {
username: req.user.username,
title: 'Главная страница',
order: orders
});
} catch (error) {
console.log(error);
}
});