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