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

kjhb #8

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
3 changes: 1 addition & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var expressValidator = require('express-validator');//req.checkbody()
const mongoConfig = require('./configs/mongo-config')
var indexRouter = require('./routes/index');
var usersRouter = require('./routes/users');

require('dotenv').config({path:'variables.env'});
mongoose.connect(mongoConfig, { useNewUrlParser: true, useCreateIndex: true, },function(error){
if(error) throw error
console.log(`connect mongodb success`);
Expand Down Expand Up @@ -62,5 +62,4 @@ app.use(function(err, req, res, next) {
// console.log(err);
res.status(err.status || 500).json(err);
});

module.exports = app;
2 changes: 1 addition & 1 deletion bin/www
Original file line number Diff line number Diff line change
Expand Up @@ -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);

/**
Expand Down
6 changes: 5 additions & 1 deletion configs/mongo-config.js
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
// export mongodb url
//const direccion="mongodb://localhost:27017/DataEComerceNode";
//const direccion="mongodb+srv://admin:<admin>@cluster0.ikple.mongodb.net/test"
const direccion ="mongodb+srv://unsaac:[email protected]/EcommerceUnsaacBD?retryWrites=true&w=majority"
//const direccion="mongodb+srv://unsaac:[email protected]/EcommerceUnsaac?retryWrites=true&w=majority"
module.exports = direccion;
9 changes: 7 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,9 @@ 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'
const frontURL="https://ecommerce-react-unsaac1.herokuapp.com/" ;
Cart.getCartById(cartId, function (err, c) {
if (err) return next(err)
if (!c) {
Expand Down
64 changes: 32 additions & 32 deletions seed/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
})
]

Expand All @@ -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'
})
]

Expand All @@ -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({
Expand All @@ -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({
Expand All @@ -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({
Expand All @@ -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({
Expand All @@ -142,7 +142,7 @@ var products =
color: 'Dark Blue',
size: 'M,L',
quantity: 80,
department: 'Men',
department: 'Varones',
category: 'Jeans',
date: 1597885814264
}),
Expand All @@ -155,7 +155,7 @@ var products =
color: 'Light Blue',
size: 'XS,S,M',
quantity: 8,
department: 'Men',
department: 'Varones',
category: 'Jeans',
date: 1581397200000
}),
Expand All @@ -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({
Expand All @@ -181,8 +181,8 @@ var products =
color: 'OYSTER WHITE',
size: 'XS,M',
quantity: 23,
department: 'Kids',
category: 'Girl',
department: 'Niños',
category: 'Niña',
date: 1597962874736
}),
new Product({
Expand All @@ -194,8 +194,8 @@ var products =
color: 'BLACK ',
size: 'XS',
quantity: 23,
department: 'Kids',
category: 'Boy',
department: 'Niños',
category: 'Niño',
date: 1597962874736
}),
];
Expand Down
1 change: 1 addition & 0 deletions seed/procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web:npm start
1 change: 1 addition & 0 deletions seed/variables.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MONGO_URI=mongodb://localhost:27017/EcommerceUnsaacBD
13 changes: 13 additions & 0 deletions server/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
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!');
});
//aaaaaaaa