question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Gettting Page not found, Initial connect to db do not work?

See original GitHub issue

Hello, i tried using this plugin with no succes

i have got this function

const service =  function() {
  const app = this;
  
  MongoClient.connect("mongodb://localhost:27017/feathers").then(client => {
    const db = client.db("EaCms");
    app.use(
      "/news",
      service({
        Model: db.collection("news")
      })
    );
  });
}

const app = feathers()

app
  .configure(hooks())
  .configure(rest())
  .configure(service)
  .configure(middleware);

export deafault app;

and i am getting

{
    "name": "NotFound",
    "message": "Page not found",
    "code": 404,
    "className": "not-found",
    "errors": {}
}

i tried doing this - commenting the connect part

const service =  function() {
  const app = this;
  /*
 MongoClient.connect("mongodb://localhost:27017/feathers").then(client => {
    const db = client.db("EaCms");
    app.use(
      "/news",
      service({
        Model: db.collection("news")
      })
    );
  });*/
 
 app.use("/testmongdb", function(req, res) {
    res.send(JSON.stringify(true));
  });
}

and i get the true response.

how use this plugin? what am i missing? is it because of connect that is async?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

0reactions
epozshcommented, Dec 28, 2017

Ohhh i missed this. thanks! Now it is working, before closing. Using postman http://localhost:3000/api/news <- this working http://localhost:3000/api/news?id=5a43c1e1162dea5dc8a264dd <- this is not working return [ ] http://localhost:3000/api/news?test=test<- this is working

http://localhost:3000/api/news/5a43c1e1162dea5dc8a264dd <- neither this working it return this

{
    "name": "NotFound",
    "message": "No record found for id '5a43c1e1162dea5dc8a264dd'",
    "code": 404,
    "className": "not-found",
    "errors": {}
}

do i have to do something else or this bug of lib?

Read more comments on GitHub >

github_iconTop Results From Across the Web

php - encounter ERROR 404 url not found when establishing ...
I'm creating a signup page, when I add required fields to establish database connections in the beginning of the body of my signup ......
Read more >
How To Fix The "Error Establishing a Database Connection" in ...
The entire page is blank because no data can be retrieved to render the page, as the connection is not working properly. Not...
Read more >
How to Fix Error Establishing a Database Connection Error
The error establishing a database connection error basically means that for some reason or another the PHP code was unable to connect to...
Read more >
How to Fix the Error Establishing a Database Connection in ...
The 'Error establishing a database connection' issue can be caused by incorrect database information in your WordPress settings, corrupt ...
Read more >
A "Error 404" error is encountered when linking a database to ...
A “Error 404” error is encountered when linking a database to Team Foundation Server in a different domain from the host · Close...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found