Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Учебный проект: вдохнуть жизнь #12

Merged
merged 4 commits into from Nov 3, 2020
Merged

Учебный проект: вдохнуть жизнь #12

merged 4 commits into from Nov 3, 2020

Conversation

efiand
Copy link
Contributor

@efiand efiand commented Nov 1, 2020

Моковые данные вынесены в js-файлы, все в одном месте
Правка ошибок линтера
Единообразие кавычек в шаблоне
@keksobot keksobot changed the title Module4 task3 Учебный проект: вдохнуть жизнь Nov 1, 2020
@@ -33,12 +33,15 @@
"supertest": "5.0.0"
},
"dependencies": {
"axios": "0.21.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

request почил, поэтому по совету учебника - axios. Может, в задании обновить забыли?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Да, всё так. Учебник только недавно обновили, до текста задания ещё не добрались.

"nanoid": "3.1.12",
"pino": "6.7.0",
"pug": "3.0.0"
"pug": "2.0.4"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Откатил в связи с pugjs/pug#3274

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

На какую интересную багу ты наткнулся, однако)

@@ -3,10 +3,9 @@
module.exports = {
DEFAULT_COMMAND: `--help`,
DEFAULT_PORT: 8080,
DEFAULT_LOCAL_PORT: 3000,
DEFAULT_API_PORT: 3000,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вроде бы логичнее получается

const {splitNumByThousands} = require(`../../utils`);

// Доработка одиночного объявления для шаблонизации
const modifyOffer = (offer) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Показалось целесообразным не выносить подобную логику на уровень представления, а в учебных примерах вообще эта тема не раскрыта.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Да, это разумно. Хотя вообще вопрос дискуссионный, и я бы не сказал, что есть единственно правильное решение.

const {modifyOffer} = require(`../lib/offers`);
const declineWord = require(`decline-word`);

const mainRouter = new Router();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Переименовал index -> main, ибо запросы-то идут не только к индексной странице.


try {
app.listen(port, (err) => {
if (err) {
return logger.error(`Ошибка при создании сервера: ${err.message}`);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Надоела борьба с кодировкой терминала, к тому же в проекте должен быть единообразный подход к одной проблеме.

*/
const splitNumByThousands = (num) => {
const str = num.toString();
if (str.length < NUM_SPLITTING_THRESHOLD) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В верстке разряды отделяются пробелом только начиная с пятизначных чисел


res.render(`search-result`, {
results,
findWord: declineWord(results.length, `Найден`, `а`, `о`, `о`),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Странно выглядят несклоняемые слова в данном месте, решил исправить этот момент без "программирования на шаблонизаторе" (возможно, потому что синтаксис мопса упорно не хочет нравиться и лишний раз туда лезть неохота (в практике уже попробовал в аналогичной связке с express любимый twig)).

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Дело хорошее, инициатива не наказуема)

@keksobot keksobot merged commit ac47ee9 into htmlacademy-nodejs:master Nov 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants