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

404 Error Code | Please help! #127

Open
SachinDevatar7 opened this issue Oct 8, 2021 · 2 comments
Open

404 Error Code | Please help! #127

SachinDevatar7 opened this issue Oct 8, 2021 · 2 comments

Comments

@SachinDevatar7
Copy link

I am getting this error(In browser):
{"errors":{"message":"Not Found","error":{"status":404}}}

And also:

[email protected] dev /Users/sachindevatar/node-express/node-express-realworld-example-app
nodemon ./app.js

[nodemon] 1.19.4
[nodemon] to restart at any time, enter rs
[nodemon] watching dir(s): .
[nodemon] watching extensions: js,mjs,json
[nodemon] starting node ./app.js
Listening on port 3000
Mongoose: users.ensureIndex({ username: 1 }) { unique: true, background: true }
Mongoose: articles.ensureIndex({ slug: 1 }) { unique: true, background: true }
Mongoose: users.ensureIndex({ email: 1 }) { unique: true, background: true }
Error: Not Found
at /Users/sachindevatar/node-express/node-express-realworld-example-app/app.js:49:13
at Layer.handle [as handle_request] (/Users/sachindevatar/node-express/node-express-realworld-example-app/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/Users/sachindevatar/node-express/node-express-realworld-example-app/node_modules/express/lib/router/index.js:312:13)
at /Users/sachindevatar/node-express/node-express-realworld-example-app/node_modules/express/lib/router/index.js:280:7
at Function.process_params (/Users/sachindevatar/node-express/node-express-realworld-example-app/node_modules/express/lib/router/index.js:330:12)
at next (/Users/sachindevatar/node-express/node-express-realworld-example-app/node_modules/express/lib/router/index.js:271:10)
at /Users/sachindevatar/node-express/node-express-realworld-example-app/node_modules/express/lib/router/index.js:618:15
at next (/Users/sachindevatar/node-express/node-express-realworld-example-app/node_modules/express/lib/router/index.js:256:14)
at Function.handle (/Users/sachindevatar/node-express/node-express-realworld-example-app/node_modules/express/lib/router/index.js:176:3)
at router (/Users/sachindevatar/node-express/node-express-realworld-example-app/node_modules/express/lib/router/index.js:46:12)
at Layer.handle [as handle_request] (/Users/sachindevatar/node-express/node-express-realworld-example-app/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/Users/sachindevatar/node-express/node-express-realworld-example-app/node_modules/express/lib/router/index.js:312:13)
at /Users/sachindevatar/node-express/node-express-realworld-example-app/node_modules/express/lib/router/index.js:280:7
at Function.process_params (/Users/sachindevatar/node-express/node-express-realworld-example-app/node_modules/express/lib/router/index.js:330:12)
at next (/Users/sachindevatar/node-express/node-express-realworld-example-app/node_modules/express/lib/router/index.js:271:10)
at Layer.handle [as handle_request] (/Users/sachindevatar/node-express/node-express-realworld-example-app/node_modules/express/lib/router/layer.js:91:12)
GET / 404 6.927 ms - 57

@project-kmac
Copy link

MongoDB is a prerequisite. Are you running mongodb prior to executing nodemon?

systemctl status mongodb systemctl start mongodb

Refer to the tutorial here: https://thinkster.io/tutorials/node-json-api
And to the MongoDB docs: https://docs.mongodb.com/manual/installation/


Additionally, check to see that how mongoose is set in your app.js file. I had to change it from "localhost" to "127.0.0.1" for it to run.

if(isProduction){ mongoose.connect(process.env.MONGODB_URI); } else { mongoose.connect('mongodb://127.0.0.1/conduit'); mongoose.set('debug', true); }

@meliwex
Copy link

meliwex commented Mar 27, 2022

This project is just API implemented in Node.js, so there is no Front-End by default.
I guess you are accessing URI / which is not handled by this application and that's why you get 404 error.

Try to access as an example URI /api/articles and if you see output {"articles":[],"articlesCount":0} then everything works correctly.

You can check all APIs available in routes folder of this project.

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

No branches or pull requests

3 participants