From 79a014ea04ad5a77fba8881a5dc4f3dc4eda7719 Mon Sep 17 00:00:00 2001 From: Cucho145U <170748@unsaac.edu.pe> Date: Tue, 15 Dec 2020 21:50:35 -0500 Subject: [PATCH 01/18] Prueba1 Solucion para poder correr el programa --- bin/www | 2 +- configs/mongo-config.js | 3 ++- package-lock.json | 4 ++-- routes/index.js | 4 ++-- seed/index.js | 4 ++-- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/bin/www b/bin/www index 6100eaf..b1e0992 100755 --- a/bin/www +++ b/bin/www @@ -13,7 +13,7 @@ var PORT = process.argv[2]&&process.argv[2].slice(-4) * Get port from environment and store in Express. */ -var port = normalizePort(process.env.PORT || PORT || '3000'); +var port = normalizePort(process.env.PORT || PORT || '4000'); app.set('port', port); /** diff --git a/configs/mongo-config.js b/configs/mongo-config.js index 3690269..1d27e4a 100644 --- a/configs/mongo-config.js +++ b/configs/mongo-config.js @@ -1 +1,2 @@ -// export mongodb url +const direccion="mongodb://localhost:27017/[DataEComerce][DataCollection]"; +module.exports = direccion; diff --git a/package-lock.json b/package-lock.json index 51fcd06..69b27d5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { - "name": "myapp", - "version": "0.0.0", + "name": "ecommerce-nodejs", + "version": "1.1.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/routes/index.js b/routes/index.js index 005508b..247ab55 100644 --- a/routes/index.js +++ b/routes/index.js @@ -164,8 +164,8 @@ router.get('/filter', function (req, res, next) { //GET /checkout router.get('/checkout/:cartId', ensureAuthenticated, function (req, res, next) { const cartId = req.params.cartId - const frontURL = 'https://zack-ecommerce-reactjs.herokuapp.com' - // const frontURL = 'http://localhost:3000' + //const frontURL = 'https://zack-ecommerce-reactjs.herokuapp.com' + const frontURL = 'http://localhost:3000' Cart.getCartById(cartId, function (err, c) { if (err) return next(err) diff --git a/seed/index.js b/seed/index.js index e2d9001..2672428 100644 --- a/seed/index.js +++ b/seed/index.js @@ -185,7 +185,7 @@ var products = category: 'Girl', date: 1597962874736 }), - new Product({ + /*new Product({ // _id: "5f3efb0d034bec1b28de7238", imagePath: 'https://static.zara.net/photos///2020/I/0/3/p/3183/700/800/2/w/560/3183700800_1_1_1.jpg?ts=1597336424462', title: 'PADDED BOMBER', @@ -197,7 +197,7 @@ var products = department: 'Kids', category: 'Boy', date: 1597962874736 - }), + }),*/ ]; for (let i = 0; i < products.length; i++) { From 9acff998f13e909aaf52c5a3080c34e5c4adb076 Mon Sep 17 00:00:00 2001 From: ManuelVelarde2212 <72516305+ManuelVelarde2212@users.noreply.github.com> Date: Mon, 21 Dec 2020 16:53:55 -0500 Subject: [PATCH 02/18] Update index.js --- seed/index.js | 68 +++++++++++++++++++++++++-------------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/seed/index.js b/seed/index.js index 2672428..9f898d5 100644 --- a/seed/index.js +++ b/seed/index.js @@ -11,25 +11,25 @@ mongoose.connect(mongoConfig, { useNewUrlParser: true, useCreateIndex: true, }); var categories = [ new Category({ - categoryName: 'Basics' + categoryName: 'Basicos' }), new Category({ - categoryName: 'Blazer' + categoryName: 'Chaqueta' }), new Category({ - categoryName: 'Knitwear' + categoryName: 'Prendas de punto' }), new Category({ categoryName: 'Jeans' }), new Category({ - categoryName: 'Jackets' + categoryName: 'Campera' }), new Category({ - categoryName: 'Girl' + categoryName: 'Niña' }), new Category({ - categoryName: 'Boy' + categoryName: 'Niño' }) ] @@ -44,17 +44,17 @@ for (let i = 0; i < categories.length; i++) { var departments = [ new Department({ - departmentName: 'Women', - categories: 'Basics,Blazer' + departmentName: 'Mujeres', + categories: 'Basicos,Chaqueta' }), new Department({ - departmentName: 'Men', - categories: 'Knitwear,Jeans,Jackets' + departmentName: 'Varones', + categories: 'Prendas de punto,Jeans,Campera' }), new Department({ - departmentName: 'Kids', - categories: 'Girl,Boy' + departmentName: 'Niños', + categories: 'Niña,Niño' }) ] @@ -77,8 +77,8 @@ var products = color: 'Gray', size: 'XS,S,M', quantity: 10, - department: 'Women', - category: 'Basics', + department: 'Mujeres', + category: 'Basicos', date: 1581397200000 }), new Product({ @@ -90,8 +90,8 @@ var products = color: 'Black', size: 'XS,S,XL', quantity: 15, - department: 'Women', - category: 'Basics', + department: 'Mujeres', + category: 'Basicos', date: 1597885814264 }), new Product({ @@ -103,21 +103,21 @@ var products = color: 'White', size: 'XS', quantity: 90, - department: 'Women', - category: 'Basics', + department: 'Mujeres', + category: 'Basicos', date: 1581397200000 }), new Product({ _id: "5bedf55bc14d7822b39d9d4b", imagePath: 'https://static.zara.net/photos///2018/I/0/1/p/8197/757/093/4/w/1920/8197757093_2_2_1.jpg?ts=1538393944729', - title: 'Belted Plaid Blazer', - description: 'Flowy blazer with lapel collar and long sleeves. Self belt. Chest patch pockets and welt pockets at hip. Front double-breasted button closure.', + title: 'Belted Plaid Chaqueta', + description: 'Flowy Chaqueta with lapel collar and long sleeves. Self belt. Chest patch pockets and welt pockets at hip. Front double-breasted button closure.', price: 79.99, color: 'Black', size: 'S,M,L', quantity: 4, - department: 'Women', - category: 'Blazer', + department: 'Mujeres', + category: 'Chaqueta', date: 1581397200000 }), new Product({ @@ -129,8 +129,8 @@ var products = color: 'Orange', size: 'M,L', quantity: 5, - department: 'Men', - category: 'Knitwear', + department: 'Varones', + category: 'Prendas de punto', date: 1597885814264 }), new Product({ @@ -142,7 +142,7 @@ var products = color: 'Dark Blue', size: 'M,L', quantity: 80, - department: 'Men', + department: 'Varones', category: 'Jeans', date: 1597885814264 }), @@ -155,7 +155,7 @@ var products = color: 'Light Blue', size: 'XS,S,M', quantity: 8, - department: 'Men', + department: 'Varones', category: 'Jeans', date: 1581397200000 }), @@ -168,8 +168,8 @@ var products = color: 'Brown', size: 'XS,M,XL', quantity: 12, - department: 'Men', - category: 'Jackets', + department: 'Varones', + category: 'Campera', date: 1581397200000 }), new Product({ @@ -181,11 +181,11 @@ var products = color: 'OYSTER WHITE', size: 'XS,M', quantity: 23, - department: 'Kids', - category: 'Girl', + department: 'Niños', + category: 'Niña', date: 1597962874736 }), - /*new Product({ + new Product({ // _id: "5f3efb0d034bec1b28de7238", imagePath: 'https://static.zara.net/photos///2020/I/0/3/p/3183/700/800/2/w/560/3183700800_1_1_1.jpg?ts=1597336424462', title: 'PADDED BOMBER', @@ -194,10 +194,10 @@ var products = color: 'BLACK ', size: 'XS', quantity: 23, - department: 'Kids', - category: 'Boy', + department: 'Niños', + category: 'Niño', date: 1597962874736 - }),*/ + }), ]; for (let i = 0; i < products.length; i++) { From 0b2f661fe3646a4d7f31612ea5868cd1ac19a6bb Mon Sep 17 00:00:00 2001 From: Cucho145U <170748@unsaac.edu.pe> Date: Wed, 6 Jan 2021 02:49:41 -0500 Subject: [PATCH 03/18] aaaaaaa --- configs/mongo-config.js | 4 +++- server/server.js | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 server/server.js diff --git a/configs/mongo-config.js b/configs/mongo-config.js index 1d27e4a..cf55c64 100644 --- a/configs/mongo-config.js +++ b/configs/mongo-config.js @@ -1,2 +1,4 @@ -const direccion="mongodb://localhost:27017/[DataEComerce][DataCollection]"; +//const direccion="mongodb://localhost:27017/DataEComerceNode"; +//const direccion="mongodb+srv://admin:@cluster0.ikple.mongodb.net/test" +const direccion ="mongodb+srv://unsaac:unsaac123@primero.6gh6z.mongodb.net/EcommerceUnsaac?retryWrites=true&w=majority" module.exports = direccion; diff --git a/server/server.js b/server/server.js new file mode 100644 index 0000000..bd656e1 --- /dev/null +++ b/server/server.js @@ -0,0 +1,12 @@ +const path = require('path'); +const express = require('express'); +const app = express(); +const publicPath = path.join(__dirname, '..', 'public'); +const port = process.env.PORT || 4000; +app.use(express.static(publicPath)); +app.get('*', (req, res) => { + res.sendFile(path.join(publicPath, 'index.html')); +}); +app.listen(port, () => { + console.log('Server is up!'); +}); \ No newline at end of file From 4b61f9ea662cac83d0c61de5aca2d9487f08879c Mon Sep 17 00:00:00 2001 From: Cucho145U <170748@unsaac.edu.pe> Date: Thu, 7 Jan 2021 20:54:56 -0500 Subject: [PATCH 04/18] cambio 1 --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index ea8cea2..afdd83f 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,8 @@ "version": "1.1.0", "private": true, "scripts": { - "start": "node ./bin/www" + "start": "node server/server.js", + "postinstall": "ng build" }, "dependencies": { "bcryptjs": "^2.4.3", From 33e11f351b65a212364c2afeca71eb96e6d3358e Mon Sep 17 00:00:00 2001 From: Cucho145U <170748@unsaac.edu.pe> Date: Thu, 7 Jan 2021 20:57:25 -0500 Subject: [PATCH 05/18] cambio 2 --- server/server.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/server.js b/server/server.js index bd656e1..19abadb 100644 --- a/server/server.js +++ b/server/server.js @@ -9,4 +9,5 @@ app.get('*', (req, res) => { }); app.listen(port, () => { console.log('Server is up!'); -}); \ No newline at end of file +}); +//aaaaaaaa \ No newline at end of file From 7a79912b58df476c1179b7ae5312f83074f0eeb7 Mon Sep 17 00:00:00 2001 From: Cucho145U <170748@unsaac.edu.pe> Date: Thu, 7 Jan 2021 20:58:02 -0500 Subject: [PATCH 06/18] cambio 3 --- package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index afdd83f..751654d 100644 --- a/package.json +++ b/package.json @@ -3,8 +3,7 @@ "version": "1.1.0", "private": true, "scripts": { - "start": "node server/server.js", - "postinstall": "ng build" + "start": "node server/server.js" }, "dependencies": { "bcryptjs": "^2.4.3", From c4b478c24de208dbefe89436a0ae2c0e311e8e37 Mon Sep 17 00:00:00 2001 From: Cucho145U <170748@unsaac.edu.pe> Date: Thu, 7 Jan 2021 21:08:15 -0500 Subject: [PATCH 07/18] cambio 4 --- app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.js b/app.js index be50642..7456a1c 100644 --- a/app.js +++ b/app.js @@ -62,5 +62,5 @@ app.use(function(err, req, res, next) { // console.log(err); res.status(err.status || 500).json(err); }); - +console.log("aaaaaaaaaaa") module.exports = app; From 7251ef2249038857c07b231563e438bc99545133 Mon Sep 17 00:00:00 2001 From: Cucho145U <170748@unsaac.edu.pe> Date: Thu, 7 Jan 2021 21:10:18 -0500 Subject: [PATCH 08/18] cambio 5 --- bin/www | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/www b/bin/www index b1e0992..8081609 100755 --- a/bin/www +++ b/bin/www @@ -90,4 +90,5 @@ function onListening() { console.log(`server listening on ${addr.port}`); debug('Listening on ' + bind); + console.log("aaaaa"); } From 7149a001b1e26570049c765cb63a7b780c306a7f Mon Sep 17 00:00:00 2001 From: Cucho145U <170748@unsaac.edu.pe> Date: Thu, 7 Jan 2021 21:19:19 -0500 Subject: [PATCH 09/18] cambio 6 --- routes/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/routes/index.js b/routes/index.js index 247ab55..89c34e9 100644 --- a/routes/index.js +++ b/routes/index.js @@ -165,8 +165,8 @@ router.get('/filter', function (req, res, next) { router.get('/checkout/:cartId', ensureAuthenticated, function (req, res, next) { const cartId = req.params.cartId //const frontURL = 'https://zack-ecommerce-reactjs.herokuapp.com' - const frontURL = 'http://localhost:3000' - + //const frontURL = 'http://localhost:3000' + const frontURL="https://ecommerce-react-unsaac1.herokuapp.com/" ; Cart.getCartById(cartId, function (err, c) { if (err) return next(err) if (!c) { From 9f33db87a38b992c91655fad628e995069bd6dfa Mon Sep 17 00:00:00 2001 From: Cucho145U <170748@unsaac.edu.pe> Date: Thu, 7 Jan 2021 21:21:28 -0500 Subject: [PATCH 10/18] cambio 7 --- routes/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/routes/index.js b/routes/index.js index 89c34e9..cd10fb1 100644 --- a/routes/index.js +++ b/routes/index.js @@ -165,8 +165,8 @@ router.get('/filter', function (req, res, next) { router.get('/checkout/:cartId', ensureAuthenticated, function (req, res, next) { const cartId = req.params.cartId //const frontURL = 'https://zack-ecommerce-reactjs.herokuapp.com' - //const frontURL = 'http://localhost:3000' - const frontURL="https://ecommerce-react-unsaac1.herokuapp.com/" ; + const frontURL = 'http://localhost:3000' + //const frontURL="https://ecommerce-react-unsaac1.herokuapp.com/" ; Cart.getCartById(cartId, function (err, c) { if (err) return next(err) if (!c) { From faf3cce2943b4c923f4157f901bfd3cb764e9269 Mon Sep 17 00:00:00 2001 From: Cucho145U <170748@unsaac.edu.pe> Date: Mon, 18 Jan 2021 21:38:43 -0500 Subject: [PATCH 11/18] Update package.json Cambio de direccion --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 751654d..ea8cea2 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "1.1.0", "private": true, "scripts": { - "start": "node server/server.js" + "start": "node ./bin/www" }, "dependencies": { "bcryptjs": "^2.4.3", From 053ad464033d9e0889704339e4560db0bb3b6e53 Mon Sep 17 00:00:00 2001 From: Cucho145U <170748@unsaac.edu.pe> Date: Mon, 18 Jan 2021 22:26:34 -0500 Subject: [PATCH 12/18] Revert "Merge pull request #1 from Cucho145U/Alex-Manuel" This reverts commit 72470b2d96b890cf682a57318160aad7a41b2b70, reversing changes made to 79a014ea04ad5a77fba8881a5dc4f3dc4eda7719. --- seed/index.js | 68 +++++++++++++++++++++++++-------------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/seed/index.js b/seed/index.js index 9f898d5..2672428 100644 --- a/seed/index.js +++ b/seed/index.js @@ -11,25 +11,25 @@ mongoose.connect(mongoConfig, { useNewUrlParser: true, useCreateIndex: true, }); var categories = [ new Category({ - categoryName: 'Basicos' + categoryName: 'Basics' }), new Category({ - categoryName: 'Chaqueta' + categoryName: 'Blazer' }), new Category({ - categoryName: 'Prendas de punto' + categoryName: 'Knitwear' }), new Category({ categoryName: 'Jeans' }), new Category({ - categoryName: 'Campera' + categoryName: 'Jackets' }), new Category({ - categoryName: 'Niña' + categoryName: 'Girl' }), new Category({ - categoryName: 'Niño' + categoryName: 'Boy' }) ] @@ -44,17 +44,17 @@ for (let i = 0; i < categories.length; i++) { var departments = [ new Department({ - departmentName: 'Mujeres', - categories: 'Basicos,Chaqueta' + departmentName: 'Women', + categories: 'Basics,Blazer' }), new Department({ - departmentName: 'Varones', - categories: 'Prendas de punto,Jeans,Campera' + departmentName: 'Men', + categories: 'Knitwear,Jeans,Jackets' }), new Department({ - departmentName: 'Niños', - categories: 'Niña,Niño' + departmentName: 'Kids', + categories: 'Girl,Boy' }) ] @@ -77,8 +77,8 @@ var products = color: 'Gray', size: 'XS,S,M', quantity: 10, - department: 'Mujeres', - category: 'Basicos', + department: 'Women', + category: 'Basics', date: 1581397200000 }), new Product({ @@ -90,8 +90,8 @@ var products = color: 'Black', size: 'XS,S,XL', quantity: 15, - department: 'Mujeres', - category: 'Basicos', + department: 'Women', + category: 'Basics', date: 1597885814264 }), new Product({ @@ -103,21 +103,21 @@ var products = color: 'White', size: 'XS', quantity: 90, - department: 'Mujeres', - category: 'Basicos', + department: 'Women', + category: 'Basics', date: 1581397200000 }), new Product({ _id: "5bedf55bc14d7822b39d9d4b", imagePath: 'https://static.zara.net/photos///2018/I/0/1/p/8197/757/093/4/w/1920/8197757093_2_2_1.jpg?ts=1538393944729', - title: 'Belted Plaid Chaqueta', - description: 'Flowy Chaqueta with lapel collar and long sleeves. Self belt. Chest patch pockets and welt pockets at hip. Front double-breasted button closure.', + title: 'Belted Plaid Blazer', + description: 'Flowy blazer with lapel collar and long sleeves. Self belt. Chest patch pockets and welt pockets at hip. Front double-breasted button closure.', price: 79.99, color: 'Black', size: 'S,M,L', quantity: 4, - department: 'Mujeres', - category: 'Chaqueta', + department: 'Women', + category: 'Blazer', date: 1581397200000 }), new Product({ @@ -129,8 +129,8 @@ var products = color: 'Orange', size: 'M,L', quantity: 5, - department: 'Varones', - category: 'Prendas de punto', + department: 'Men', + category: 'Knitwear', date: 1597885814264 }), new Product({ @@ -142,7 +142,7 @@ var products = color: 'Dark Blue', size: 'M,L', quantity: 80, - department: 'Varones', + department: 'Men', category: 'Jeans', date: 1597885814264 }), @@ -155,7 +155,7 @@ var products = color: 'Light Blue', size: 'XS,S,M', quantity: 8, - department: 'Varones', + department: 'Men', category: 'Jeans', date: 1581397200000 }), @@ -168,8 +168,8 @@ var products = color: 'Brown', size: 'XS,M,XL', quantity: 12, - department: 'Varones', - category: 'Campera', + department: 'Men', + category: 'Jackets', date: 1581397200000 }), new Product({ @@ -181,11 +181,11 @@ var products = color: 'OYSTER WHITE', size: 'XS,M', quantity: 23, - department: 'Niños', - category: 'Niña', + department: 'Kids', + category: 'Girl', date: 1597962874736 }), - new Product({ + /*new Product({ // _id: "5f3efb0d034bec1b28de7238", imagePath: 'https://static.zara.net/photos///2020/I/0/3/p/3183/700/800/2/w/560/3183700800_1_1_1.jpg?ts=1597336424462', title: 'PADDED BOMBER', @@ -194,10 +194,10 @@ var products = color: 'BLACK ', size: 'XS', quantity: 23, - department: 'Niños', - category: 'Niño', + department: 'Kids', + category: 'Boy', date: 1597962874736 - }), + }),*/ ]; for (let i = 0; i < products.length; i++) { From c2a241329c8cc030da374fdc392bbbdb79253752 Mon Sep 17 00:00:00 2001 From: Cucho145U <170748@unsaac.edu.pe> Date: Mon, 18 Jan 2021 22:37:26 -0500 Subject: [PATCH 13/18] cambios de solucion merge para retornar a una version anterior --- configs/mongo-config.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/configs/mongo-config.js b/configs/mongo-config.js index cf55c64..c112cd5 100644 --- a/configs/mongo-config.js +++ b/configs/mongo-config.js @@ -1,4 +1,5 @@ -//const direccion="mongodb://localhost:27017/DataEComerceNode"; +const direccion="mongodb://localhost:27017/DataEComerceNode"; //const direccion="mongodb+srv://admin:@cluster0.ikple.mongodb.net/test" -const direccion ="mongodb+srv://unsaac:unsaac123@primero.6gh6z.mongodb.net/EcommerceUnsaac?retryWrites=true&w=majority" +//const direccion ="mongodb+srv://unsaac:unsaac123@primero.6gh6z.mongodb.net/EcommerceUnsaac?retryWrites=true&w=majority" +//const direccion="mongodb+srv://unsaac:unsaac123@primero.6gh6z.mongodb.net/EcommerceUnsaac?retryWrites=true&w=majority" module.exports = direccion; From 635330b97e33872cf7de266f619055a236d1dc67 Mon Sep 17 00:00:00 2001 From: Cucho145U <170748@unsaac.edu.pe> Date: Tue, 19 Jan 2021 21:58:19 -0500 Subject: [PATCH 14/18] cambio server cambio servidor a el web --- app.js | 1 - bin/www | 1 - configs/mongo-config.js | 4 ++-- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app.js b/app.js index 7456a1c..5e93dbf 100644 --- a/app.js +++ b/app.js @@ -62,5 +62,4 @@ app.use(function(err, req, res, next) { // console.log(err); res.status(err.status || 500).json(err); }); -console.log("aaaaaaaaaaa") module.exports = app; diff --git a/bin/www b/bin/www index 8081609..b1e0992 100755 --- a/bin/www +++ b/bin/www @@ -90,5 +90,4 @@ function onListening() { console.log(`server listening on ${addr.port}`); debug('Listening on ' + bind); - console.log("aaaaa"); } diff --git a/configs/mongo-config.js b/configs/mongo-config.js index c112cd5..53ea32f 100644 --- a/configs/mongo-config.js +++ b/configs/mongo-config.js @@ -1,5 +1,5 @@ -const direccion="mongodb://localhost:27017/DataEComerceNode"; +//const direccion="mongodb://localhost:27017/DataEComerceNode"; //const direccion="mongodb+srv://admin:@cluster0.ikple.mongodb.net/test" -//const direccion ="mongodb+srv://unsaac:unsaac123@primero.6gh6z.mongodb.net/EcommerceUnsaac?retryWrites=true&w=majority" +const direccion ="mongodb+srv://unsaac:unsaac123@primero.6gh6z.mongodb.net/EcommerceUnsaac?retryWrites=true&w=majority" //const direccion="mongodb+srv://unsaac:unsaac123@primero.6gh6z.mongodb.net/EcommerceUnsaac?retryWrites=true&w=majority" module.exports = direccion; From 5d3c18da91cbb0f4daea256b4989af80e47dda7b Mon Sep 17 00:00:00 2001 From: Cucho145U <170748@unsaac.edu.pe> Date: Fri, 22 Jan 2021 14:40:09 -0500 Subject: [PATCH 15/18] Intento tutorial 6 min --- app.js | 6 +++--- configs/mongo-config.js | 2 +- routes/index.js | 4 ++-- seed/index.js | 5 +++-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app.js b/app.js index 5e93dbf..b062b8b 100644 --- a/app.js +++ b/app.js @@ -7,11 +7,11 @@ var express = require('express'); var mongoose = require('mongoose'); var cors = require('cors') var expressValidator = require('express-validator');//req.checkbody() -const mongoConfig = require('./configs/mongo-config') +//const mongoConfig = require('./configs/mongo-config') var indexRouter = require('./routes/index'); var usersRouter = require('./routes/users'); - -mongoose.connect(mongoConfig, { useNewUrlParser: true, useCreateIndex: true, },function(error){ +require('dotenv').config({path:'variables.env'}); +mongoose.connect(process.env.MONGO_URI, { useNewUrlParser: true, useCreateIndex: true, },function(error){ if(error) throw error console.log(`connect mongodb success`); }); diff --git a/configs/mongo-config.js b/configs/mongo-config.js index 53ea32f..2d70368 100644 --- a/configs/mongo-config.js +++ b/configs/mongo-config.js @@ -1,5 +1,5 @@ //const direccion="mongodb://localhost:27017/DataEComerceNode"; //const direccion="mongodb+srv://admin:@cluster0.ikple.mongodb.net/test" -const direccion ="mongodb+srv://unsaac:unsaac123@primero.6gh6z.mongodb.net/EcommerceUnsaac?retryWrites=true&w=majority" +const direccion ="mongodb+srv://unsaac:unsaac123@primero.6gh6z.mongodb.net/EcommerceUnsaacBD?retryWrites=true&w=majority" //const direccion="mongodb+srv://unsaac:unsaac123@primero.6gh6z.mongodb.net/EcommerceUnsaac?retryWrites=true&w=majority" module.exports = direccion; diff --git a/routes/index.js b/routes/index.js index cd10fb1..89c34e9 100644 --- a/routes/index.js +++ b/routes/index.js @@ -165,8 +165,8 @@ router.get('/filter', function (req, res, next) { router.get('/checkout/:cartId', ensureAuthenticated, function (req, res, next) { const cartId = req.params.cartId //const frontURL = 'https://zack-ecommerce-reactjs.herokuapp.com' - const frontURL = 'http://localhost:3000' - //const frontURL="https://ecommerce-react-unsaac1.herokuapp.com/" ; + //const frontURL = 'http://localhost:3000' + const frontURL="https://ecommerce-react-unsaac1.herokuapp.com/" ; Cart.getCartById(cartId, function (err, c) { if (err) return next(err) if (!c) { diff --git a/seed/index.js b/seed/index.js index 2672428..dc21b00 100644 --- a/seed/index.js +++ b/seed/index.js @@ -4,8 +4,9 @@ var Department = require('../models/Department'); var Product = require('../models/Product'); var Variant = require('../models/Variant'); var mongoose = require('mongoose'); -const mongoConfig = require('../configs/mongo-config') -mongoose.connect(mongoConfig, { useNewUrlParser: true, useCreateIndex: true, }); +//const mongoConfig = require('../configs/mongo-config') +require('dotenv').config({path:'variables.env'}); +mongoose.connect(process.env.MONGO_URI, { useNewUrlParser: true, useCreateIndex: true, }); var categories = From d9040ee90324631e8c1f8353c292b722ed0a4647 Mon Sep 17 00:00:00 2001 From: Cucho145U <170748@unsaac.edu.pe> Date: Fri, 22 Jan 2021 15:28:57 -0500 Subject: [PATCH 16/18] Cambios --- seed/procfile | 1 + seed/variables.env | 1 + 2 files changed, 2 insertions(+) create mode 100644 seed/procfile create mode 100644 seed/variables.env diff --git a/seed/procfile b/seed/procfile new file mode 100644 index 0000000..9641b92 --- /dev/null +++ b/seed/procfile @@ -0,0 +1 @@ +web:npm start \ No newline at end of file diff --git a/seed/variables.env b/seed/variables.env new file mode 100644 index 0000000..1b82501 --- /dev/null +++ b/seed/variables.env @@ -0,0 +1 @@ +MONGO_URI=mongodb://localhost:27017/EcommerceUnsaacBD \ No newline at end of file From 5e4bb9b23c5a9514baaad1b31d95fcbc1d28af2c Mon Sep 17 00:00:00 2001 From: Cucho145U <170748@unsaac.edu.pe> Date: Fri, 22 Jan 2021 15:45:29 -0500 Subject: [PATCH 17/18] Cambios10 --- app.js | 4 ++-- package-lock.json | 5 +++++ package.json | 1 + seed/index.js | 5 ++--- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app.js b/app.js index b062b8b..f104a2b 100644 --- a/app.js +++ b/app.js @@ -7,11 +7,11 @@ var express = require('express'); var mongoose = require('mongoose'); var cors = require('cors') var expressValidator = require('express-validator');//req.checkbody() -//const mongoConfig = require('./configs/mongo-config') +const mongoConfig = require('./configs/mongo-config') var indexRouter = require('./routes/index'); var usersRouter = require('./routes/users'); require('dotenv').config({path:'variables.env'}); -mongoose.connect(process.env.MONGO_URI, { useNewUrlParser: true, useCreateIndex: true, },function(error){ +mongoose.connect(mongoConfig, { useNewUrlParser: true, useCreateIndex: true, },function(error){ if(error) throw error console.log(`connect mongodb success`); }); diff --git a/package-lock.json b/package-lock.json index 69b27d5..169119a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -846,6 +846,11 @@ "is-obj": "^1.0.0" } }, + "dotenv": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz", + "integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==" + }, "duplexer3": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", diff --git a/package.json b/package.json index ea8cea2..8c81ed4 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "cookie-parser": "^1.4.4", "cors": "^2.8.5", "debug": "^2.6.9", + "dotenv": "^8.2.0", "express": "^4.16.4", "express-handlebars": "^3.0.2", "express-messages": "^1.0.1", diff --git a/seed/index.js b/seed/index.js index dc21b00..2672428 100644 --- a/seed/index.js +++ b/seed/index.js @@ -4,9 +4,8 @@ var Department = require('../models/Department'); var Product = require('../models/Product'); var Variant = require('../models/Variant'); var mongoose = require('mongoose'); -//const mongoConfig = require('../configs/mongo-config') -require('dotenv').config({path:'variables.env'}); -mongoose.connect(process.env.MONGO_URI, { useNewUrlParser: true, useCreateIndex: true, }); +const mongoConfig = require('../configs/mongo-config') +mongoose.connect(mongoConfig, { useNewUrlParser: true, useCreateIndex: true, }); var categories = From 03f89b6fdbc565bfa621ea396402c4d06be36c0e Mon Sep 17 00:00:00 2001 From: Cucho145U <170748@unsaac.edu.pe> Date: Sun, 24 Jan 2021 20:00:11 -0500 Subject: [PATCH 18/18] Cambio bd traduccion Se cambio el idioma --- seed/index.js | 68 +++++++++++++++++++++++++-------------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/seed/index.js b/seed/index.js index 2672428..9f898d5 100644 --- a/seed/index.js +++ b/seed/index.js @@ -11,25 +11,25 @@ mongoose.connect(mongoConfig, { useNewUrlParser: true, useCreateIndex: true, }); var categories = [ new Category({ - categoryName: 'Basics' + categoryName: 'Basicos' }), new Category({ - categoryName: 'Blazer' + categoryName: 'Chaqueta' }), new Category({ - categoryName: 'Knitwear' + categoryName: 'Prendas de punto' }), new Category({ categoryName: 'Jeans' }), new Category({ - categoryName: 'Jackets' + categoryName: 'Campera' }), new Category({ - categoryName: 'Girl' + categoryName: 'Niña' }), new Category({ - categoryName: 'Boy' + categoryName: 'Niño' }) ] @@ -44,17 +44,17 @@ for (let i = 0; i < categories.length; i++) { var departments = [ new Department({ - departmentName: 'Women', - categories: 'Basics,Blazer' + departmentName: 'Mujeres', + categories: 'Basicos,Chaqueta' }), new Department({ - departmentName: 'Men', - categories: 'Knitwear,Jeans,Jackets' + departmentName: 'Varones', + categories: 'Prendas de punto,Jeans,Campera' }), new Department({ - departmentName: 'Kids', - categories: 'Girl,Boy' + departmentName: 'Niños', + categories: 'Niña,Niño' }) ] @@ -77,8 +77,8 @@ var products = color: 'Gray', size: 'XS,S,M', quantity: 10, - department: 'Women', - category: 'Basics', + department: 'Mujeres', + category: 'Basicos', date: 1581397200000 }), new Product({ @@ -90,8 +90,8 @@ var products = color: 'Black', size: 'XS,S,XL', quantity: 15, - department: 'Women', - category: 'Basics', + department: 'Mujeres', + category: 'Basicos', date: 1597885814264 }), new Product({ @@ -103,21 +103,21 @@ var products = color: 'White', size: 'XS', quantity: 90, - department: 'Women', - category: 'Basics', + department: 'Mujeres', + category: 'Basicos', date: 1581397200000 }), new Product({ _id: "5bedf55bc14d7822b39d9d4b", imagePath: 'https://static.zara.net/photos///2018/I/0/1/p/8197/757/093/4/w/1920/8197757093_2_2_1.jpg?ts=1538393944729', - title: 'Belted Plaid Blazer', - description: 'Flowy blazer with lapel collar and long sleeves. Self belt. Chest patch pockets and welt pockets at hip. Front double-breasted button closure.', + title: 'Belted Plaid Chaqueta', + description: 'Flowy Chaqueta with lapel collar and long sleeves. Self belt. Chest patch pockets and welt pockets at hip. Front double-breasted button closure.', price: 79.99, color: 'Black', size: 'S,M,L', quantity: 4, - department: 'Women', - category: 'Blazer', + department: 'Mujeres', + category: 'Chaqueta', date: 1581397200000 }), new Product({ @@ -129,8 +129,8 @@ var products = color: 'Orange', size: 'M,L', quantity: 5, - department: 'Men', - category: 'Knitwear', + department: 'Varones', + category: 'Prendas de punto', date: 1597885814264 }), new Product({ @@ -142,7 +142,7 @@ var products = color: 'Dark Blue', size: 'M,L', quantity: 80, - department: 'Men', + department: 'Varones', category: 'Jeans', date: 1597885814264 }), @@ -155,7 +155,7 @@ var products = color: 'Light Blue', size: 'XS,S,M', quantity: 8, - department: 'Men', + department: 'Varones', category: 'Jeans', date: 1581397200000 }), @@ -168,8 +168,8 @@ var products = color: 'Brown', size: 'XS,M,XL', quantity: 12, - department: 'Men', - category: 'Jackets', + department: 'Varones', + category: 'Campera', date: 1581397200000 }), new Product({ @@ -181,11 +181,11 @@ var products = color: 'OYSTER WHITE', size: 'XS,M', quantity: 23, - department: 'Kids', - category: 'Girl', + department: 'Niños', + category: 'Niña', date: 1597962874736 }), - /*new Product({ + new Product({ // _id: "5f3efb0d034bec1b28de7238", imagePath: 'https://static.zara.net/photos///2020/I/0/3/p/3183/700/800/2/w/560/3183700800_1_1_1.jpg?ts=1597336424462', title: 'PADDED BOMBER', @@ -194,10 +194,10 @@ var products = color: 'BLACK ', size: 'XS', quantity: 23, - department: 'Kids', - category: 'Boy', + department: 'Niños', + category: 'Niño', date: 1597962874736 - }),*/ + }), ]; for (let i = 0; i < products.length; i++) {