Skip to content

Commit

Permalink
ff
Browse files Browse the repository at this point in the history
  • Loading branch information
8YBY8 committed Apr 1, 2024
1 parent a80c990 commit 5defe5a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
Binary file modified README.md
Binary file not shown.
2 changes: 1 addition & 1 deletion backend/api/reviews.route.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import ReviewsCtrl from "./reviews.controller.js"

const router = express.Router()

// router.route("/").get((req, res) => res.send("Hello world!"))
router.route("/").get((req, res) => res.send("Hello world!"))
router.route("/move/:id").get(ReviewsCtrl.apiGetReviews)
router.route("/new").post(ReviewsCtrl.apiPostReview)
router.route("/:id")
Expand Down
15 changes: 9 additions & 6 deletions backend/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,32 @@ import mongodb from "mongodb"
import ReviewDAO from "./dao/reviewsDAO.js"

const MongoClient = mongodb.MongoClient
const mongo_username = process.env["MONGODB_USERNAME"]
console.log(mongo_username)
const mongo_password = process.env["MONGODB_PASSWORD"]
console.log(mongo_password)
// const mongo_username = process.env["MONGODB_USERNAME"]
// console.log(mongo_username)
// const mongo_password = process.env["MONGODB_PASSWORD"]
// console.log(mongo_password)
// const uri = `mongodb+srv://${mongo_username}:${mongo_password}@cluster0.itvqll5.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0`
const uri = `mongodb+srv://yubingyang9:[email protected]/?retryWrites=true&w=majority&appName=Cluster0`
// mongodb+srv://yubingyang9:<password>@cluster0.itvqll5.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0

const port = 8000

console.log("connecting " + uri)
MongoClient.connect(
uri,
{
maxPoolSize: 50,
wtimeoutMS: 2500,
useNewUrlParser: true
useNewUrlParser: true,
// console.log("connected!!!")
})
// catch any error happens when you connect
.catch(err => {
console.error(err.stack)
process.exit(1) // ending the program
})
.then(async client => {
await ReviewDAO.injectDB(client)
// await ReviewDAO.injectDB(client)
app.listen(port, () => {
console.log(`listening on port ${port}`)
})
Expand Down

0 comments on commit 5defe5a

Please sign in to comment.