Giter VIP home page Giter VIP logo

Comments (3)

vinitkumar avatar vinitkumar commented on June 12, 2024

@Engineering-Robert I think there is an issue with your config. Did you check if all the required keys and all are there. Also, you need mongodb running using mongod for it to work.

Sharing my config, this should work for you too.

const path = require("path");
const rootPath = path.normalize(__dirname + "/..");

module.exports = {
  development: {
    db: "mongodb://localhost/ntwitter",
    root: rootPath,
    app: {
      name: "Node Twitter"
    },
    github: {
      clientID: "e3930cf94c772ba10ef1",
      clientSecret: "fb1284b1874444a9c0c55c963092f836596ecc56",
      callbackURL: "http://localhost:3000/auth/github/callback"
    }
  },
  test: {
    db: "mongodb://root:[email protected]:39078/ntwitter",
    root: rootPath,
    app: {
      name: "Nodejs Express Mongoose Demo"
    },
    github: {
      clientID: "c2e0f478634366e1289d",
      clientSecret: "0bfde82383deeb99b28d0f6a9eac001a0deb798a",
      callbackURL: "http://nitter.herokuapp.com/auth/github/callback"
    }
  },
  production: {
    db: "mongodb://root:[email protected]:39078/ntwitter",
    root: rootPath,
    app: {
      name: "Nodejs Express Mongoose Demo"
    },
    github: {
      clientID: "c2e0f478634366e1289d",
      clientSecret: "0bfde82383deeb99b28d0f6a9eac001a0deb798a",
      callbackURL: "http://nitter.herokuapp.com/auth/github/callback"
    }
  }
};

from node-twitter.

robertcoopercode avatar robertcoopercode commented on June 12, 2024

I don't think it's a problem with the config. The issue appears to be with this bit of code in /node-twitter/app/controllers/tweets.js

exports.create = (req, res) => {
  logAnalytics(req);
  const tweet = new Tweet(req.body);
  tweet.user = req.user;
  tweet.uploadAndSave(req.files.image, err => {
    if (err) {
      res.render("tweets/new", {
        title: "New Tweet",
        tweet: tweet,
        error: err.errors
      });
    } else {
      res.redirect("/");
    }
  });
};

req.files.image returns undefined for me. I've passed in an empty object as the first argument to tweet.uploadAndSave and that seems to have solved the issue for now. I'm not sure what req.files.image is suppose to contain (is it a URL path to a profile image?).

from node-twitter.

robertcoopercode avatar robertcoopercode commented on June 12, 2024

Well I guess I'll close this issue since it seems like the fix I implemented isn't causing any other issues.

from node-twitter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.