so I have a controller on my app to add new officers like this
when I develop it on my localhost server it worked just fine however when I deploy it on heroku then try it again I received this error
I'm new on heroku and I honestly can't find out how to fix this can someone help me?
I'm using mongoose and mongoDB atlas btw
The data however successfully got inserted even tho the app got the error
Related
I have been trying to deploy my MERN app and but am getting this error.
This is the error i have been getting every time it try to deploy the mern app on heroku it's getting deployed but then in logs i am getting this error and link is also not working
refer to this screenshot
Why do you export your model like that??
What happen if you only require the file
const generalUser = require("../models/GeneralUsers.js")
enter image description here
I'm new to full-stack development.
I'm running my application on localhost, node.js for backend, react js for front-end, and MongoDB
everything is connected to the localhost when I try to login from the admin dashboard this error is shown any help
the error.networkError.result value is undefined, so there is no there is no undefined.errors try console.log(error.networkError) and go through the keys maybe also console.log(Object.keys(error.networkError))
I am newbie in programming restful api with nodejs and mongo db atlas.
I finished all the videos in this list https://www.youtube.com/watch?v=ucuNgSOFDZ0&index=14&list=PL55RiY5tL51q4D-B63KBnygU6opNPFk_q
I can run my code successful locally at localhost:3000 but when I deploy it on heroku, It crashes then I try with "heroku logs" and it shows that:
You can find the whole project at: https://github.com/academind/node-restful-api-tutorial/tree/13-controllers (just neet to change the password field for mongo atlas in the nodemon.json)
Please help. Thank you for your reading.
I am currently working with a team in a NodeJS project that uses express and a local MongoDB database.
We did not implement mongoose into the project, and now we are at a stage where we wish to upload the project using heroku, so that we can have a central point as we further develop different parts of the project (apps and web pages that consume the data from the database.)
We managed to upload the project to heroku, and some of the pages are working, but we can't access the database, it returns "500 - internal server error" everytime we try to access data from the MongoDB.
After some research we could only find that it's best to use MongoLAB to store the data in a cloud based datacenter, but we can't seem to find ways to connect our project with MongoLab without the use of mongoose, which we didn't install to the project.
My question is: is there a way to connect our NodeJS project to MongoLab using only the original MongoDB npm module, without having to install and use mongoose? We are at a stage that refactoring our DB-access classes, and implement mongoose, would cause our project's deadline to be delayed.
Thank you for your time.
You can definitely use mongoDB with mLab(previously mongoLab), without using mongoose.
var MongoClient = require('mongodb').MongoClient;
MongoClient.connect('mongodb://ID:PASSWORD!#SUBDOMAIN.mlab.com:PORT/DATABASE_NAME', function(err, db) {
console.log("Connected correctly to server.");
db.close();
});
I'm noob on nodejs and i'm trying some tutorials of nodejs. I'm trying this tutorial: http://cestfait.ch/content/chat-webapp-nodejs it works wonderful on my localhost but not when I upload to appfog like you can see here: http://nodebruno.hp.af.cm/
For example, the prompt don't show up. I changed the code to avoid the prompt and insert the nickname on a input text and this work on localhost but doesn't work on appfog too.
I already tried on nodejitsu servers and I have the same problem
Can you help me ?
Your app has an error, it's trying to connect to a localhost socket.io server.
You need to change this line:
var socket = io.connect('http://localhost:8000');
to
var socket = io.connect();
And it would work preferably on Nodejitsu