In short, I would like to know if I can test the mongoose challenges locally without pasting the URL.
Like many others, I’m seeing time-out issues when I’m trying to paste the Repl.it URL to the solver at FCC. Thus I tested the previous challenges locally by forking the github repository and starting the server with node server.js
. The changes were always quite visible at localhost:3000 in the browser.
However, with the MongoDB challenges I’m not quite sure how to double-check if it works. For example, I tried localhost:3000/is-mongoose-ok
because I see that this is requested in server.js
, but it says “not found”. Do I have a thinking mistake , and it is not possible to check it like this, or is my program not working?
This is from server.js
:
router.get("/is-mongoose-ok", function (req, res) {
if (mongoose) {
res.json({ isMongooseOk: !!mongoose.connection.readyState });
} else {
res.json({ isMongooseOk: false });
}
});
However, I’m checking the connection in “App.js” and it prints out “Connected Database Successfully” on the terminal command line, so I guess the database connection is not the problem:
const connection = mongoose.connection;
connection.once('open', () => {
console.log("Connected Database Successfully");
})
Your browser information:
User Agent is: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:86.0) Gecko/20100101 Firefox/86.0
.
Challenge: Install and Set Up Mongoose
Link to the challenge: