Skip to content

Kirill Makarikhin#6

Open
kirmakar wants to merge 2 commits intosanmaal:masterfrom
kirmakar:master
Open

Kirill Makarikhin#6
kirmakar wants to merge 2 commits intosanmaal:masterfrom
kirmakar:master

Conversation

@kirmakar
Copy link
Copy Markdown

No description provided.

Comment thread src/app.js
});


app.get('/login', function (req, res) {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

какие-то роуты у тебя прописаны в константы, а какие-то просто строки, лучше делать как-то одинаково

Comment thread src/db.js

const connectionString = `postgres://${user}:${password}@${server}:${port}/${database}`;

module.exports = connectionString; No newline at end of file
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

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

Comment thread src/auth.js
const selectUserByLoginQuery = `SELECT * FROM users WHERE login = '${login}'`.replace(/["]+/g,'');
const results = [];
let i = 0;
await pg.connect(connectionString, (err, client, done) => {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

что-то у тебя и await и колбек - это действительно надо прям вот так использовать?

Comment thread src/app.js
});


app.get('/content', auth, function (req, res) {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

а что этот роут делает, если я авторизован?

Comment thread src/app.js
@@ -0,0 +1,176 @@
const {express,app,ROUTES,path,pg,connectionString,bodyParser,bcrypt, passport, session} = require("./config");
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

такое общее замечание - у тебя один супер модуль, который делает все, его довольно тяжело читать, стоит разбить на несколько частей

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants