Skip to content

Commit

Permalink
Merge pull request #1 from kronicle114/feature/switch_collections
Browse files Browse the repository at this point in the history
Feature/switch collections
  • Loading branch information
kronicle114 committed Aug 4, 2019
2 parents 0a64501 + c74f46b commit 16c28ac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
7 changes: 2 additions & 5 deletions config.js
Expand Up @@ -3,11 +3,8 @@
module.exports = {
PORT: process.env.PORT || 8080,
CLIENT_ORIGIN: process.env.CLIENT_ORIGIN || 'http://localhost:3000',
DATABASE_URL:
process.env.DATABASE_URL || 'mongodb://jordan:haddadi@roadrate-shard-00-00-qquzy.mongodb.net:27017,roadrate-shard-00-01-qquzy.mongodb.net:27017,roadrate-shard-00-02-qquzy.mongodb.net:27017/test?ssl=true&replicaSet=RoadRate-shard-0&authSource=admin&retryWrites=true',
TEST_DATABASE_URL:
process.env.TEST_DATABASE_URL ||
'mongodb://localhost/thinkful-backend-test',
// DATABASE_URL: process.env.DATABASE_URL || 'mongodb+srv://jordan:haddadi@roadrate-qquzy.mongodb.net/roadrate?retryWrites=true&w=majority', // development
DATABASE_URL: process.env.DATABASE_URL || 'mongodb+srv://jordan:haddadi@roadrate-qquzy.mongodb.net/test?retryWrites=true&w=majority', //production
JWT_SECRET: process.env.JWT_SECRET || 'random-secret-key',
JWT_EXPIRY: process.env.JWT_EXPIRY || '7d'
};
9 changes: 3 additions & 6 deletions routes/reviews.js
Expand Up @@ -114,7 +114,6 @@ router.get('/:id', (req, res, next) => {

/* ========== POST/CREATE A REVIEW ========== */
router.post('/', jsonParser, (req, res, next) => {
// let user = req.body.username;
let plateNumber = req.body.plateNumber;
let reviewerId = req.body.reviewerId;
let isPositive = req.body.rating;
Expand Down Expand Up @@ -145,11 +144,9 @@ router.post('/', jsonParser, (req, res, next) => {
newReview.plateId = plate._id;
Review.create(newReview)
.then(data => {
res.status(201).json(data);
return res.status(201).json(data);
})
.catch(err => {
next(err);
});
.catch(err => next(err));
});
} else {
newReview.plateId = plate._id;
Expand All @@ -162,7 +159,7 @@ router.post('/', jsonParser, (req, res, next) => {
Plate.findById(newReview.plateId)
.then(plate => plate.updateOne({$inc: {karma: - 1}}));
}
res.status(201).json(data);
return res.status(201).json(data);
})
.catch(err => {
next(err);
Expand Down

0 comments on commit 16c28ac

Please sign in to comment.