Skip to content

Express & Mongo Eval#166

Open
bhdoggett wants to merge 28 commits intoprojectshft:masterfrom
bhdoggett:master
Open

Express & Mongo Eval#166
bhdoggett wants to merge 28 commits intoprojectshft:masterfrom
bhdoggett:master

Conversation

@bhdoggett
Copy link

No description provided.

@import "tailwindcss";

:root {
--background: #ea6df5;
Copy link

@greypants greypants Apr 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be hotpink

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

.json({ message: "Internal servor error", error: err.message });
});

mongoose.connect("mongodb://localhost/products");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add connection handle in case it fails

const currentPage = await Product.find(query)
// Sort products if price exists in query
.sort(
price === "high" ? { price: -1 } : price === "low" ? { price: 1 } : {}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to use a const on top or a different file for high and low

query.name = { $regex: search, $options: "i" };
}

const productsPerPage = 9;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to define this every time the api is called, can be a const as well

Comment on lines +110 to +111
validateProduct,
validatePageFormat,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

love interceptors, big fan

Comment on lines +142 to +146
// const pagenatedReviews = await Review.find({
// _id: { $in: product.reviews },
// })
// .skip((page - 1) * reviewsPerPage)
// .limit(reviewsPerPage);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dont commit commented code

validateProduct,
async (req, res, next) => {
try {
// const product = req.product;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

watch out

import React from "react";
import Image from "next/image";

// type ProductPropsType = {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commented code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants