mirror of
https://github.com/sergeyyarkov/digital-store.git
synced 2026-10-11 10:19:15 +03:00
env var
This commit is contained in:
parent
3d60cf0bbe
commit
aed9bbcaaa
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
node_modules
|
||||
package-lock.json
|
||||
.env
|
||||
@ -1,4 +1,4 @@
|
||||
module.exports = {
|
||||
url: 'mongodb+srv://ds_user1:zBD4b6kQbKAK2ar@cluster0-vtuzl.mongodb.net/test?retryWrites=true',
|
||||
url: process.env.DATABASE_URI,
|
||||
name: 'digital_store'
|
||||
}
|
||||
@ -126,7 +126,7 @@ module.exports = function(server, db) {
|
||||
category.length > 0 ? res.send(category) : res.send({error: 'Такой категории не существует.'});
|
||||
});
|
||||
|
||||
server.get('/api/icons', (req, res) => {
|
||||
server.get('/api/icons', checkAuthenticated, (req, res) => {
|
||||
const icons = fs.readdirSync('dist/public/img/service-icons');
|
||||
res.json(icons);
|
||||
});
|
||||
|
||||
@ -27,7 +27,10 @@ module.exports = function(server, db, qiwiApi) {
|
||||
}
|
||||
qiwiApi.createBill(billId, fields).then((data) => {
|
||||
res.send(data);
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
res.send('Произошла ошибка при создании заказа. Попробуйте позже.');
|
||||
})
|
||||
} else {
|
||||
res.send(`Товара "${req.body.items[empty].title}" нет в наличии`);
|
||||
}
|
||||
|
||||
@ -16,8 +16,7 @@ const methodOverride = require('method-override');
|
||||
const multer = require('multer');
|
||||
const QiwiBillPaymentsAPI = require('@qiwi/bill-payments-node-js-sdk');
|
||||
|
||||
const SECRET_KEY = '.';
|
||||
const qiwiApi = new QiwiBillPaymentsAPI(SECRET_KEY);
|
||||
const qiwiApi = new QiwiBillPaymentsAPI(process.env.QIWI_SECRET_KEY);
|
||||
|
||||
MongoClient.connect(db_config.url, {useNewUrlParser: true, useUnifiedTopology: true})
|
||||
.then((client) => {
|
||||
@ -65,6 +64,6 @@ MongoClient.connect(db_config.url, {useNewUrlParser: true, useUnifiedTopology: t
|
||||
.finally(() => {
|
||||
const port = process.env.PORT || 3000;
|
||||
server.listen(port, () => {
|
||||
console.log('Listen port 3000...');
|
||||
console.log('App is running...');
|
||||
});
|
||||
});
|
||||
|
||||
1
dist/public/css/style.css
vendored
1
dist/public/css/style.css
vendored
@ -508,7 +508,6 @@ footer.main-footer .container {
|
||||
.main-section .background {
|
||||
background-color: #fff;
|
||||
padding: 40px;
|
||||
margin: 40px 0;
|
||||
min-height: 650px;
|
||||
}
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "node config/server.js",
|
||||
"build": "webpack --mode production",
|
||||
"wp-server": "webpack-dev-server --mode development"
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user