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

[Backend] article-rating interlink #78

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sefinehtesfa34
Copy link

article rating interlinks

@@ -1,3 +1,4 @@
import { Article } from "../models/article";
import { Rating } from "../models/rating";

Choose a reason for hiding this comment

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

We need status codes and response messages on all responses.

@@ -72,6 +81,10 @@ export const updateRating = async (req: any, res: any) => {
try {
const rating = await Rating.findById({ _id: req.params.id })
if (!rating) return res.status(404).send("Rating not found to be updated")

Choose a reason for hiding this comment

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

Change response message since this would be shown to users on the frontend. like.. "Rating not found!"

@@ -2,7 +2,7 @@ import app from "./app"
import mongoose from 'mongoose';

const PORT = process.env.PORT || 8000
const DB_URI = process.env.MONGO_URI || "mongodb://localhost:27017/test";

Choose a reason for hiding this comment

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

No need to reveal database strings here. use env variables.

@@ -2,7 +2,7 @@ import app from "./app"
import mongoose from 'mongoose';

const PORT = process.env.PORT || 8000
const DB_URI = process.env.MONGO_URI || "mongodb://localhost:27017/test";
const DB_URI = process.env.mongodb_url || "mongodb://localhost:27017/rating";

Choose a reason for hiding this comment

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

make the variable naming better and readable.. like MONGO_URI and MONGO_URI_TEST bla bla :)

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.

2 participants