Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6853881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:33:53+00:00 2026-05-27T01:33:53+00:00

I just started getting into node.js and followed this great tutorial on node.js at

  • 0

I just started getting into node.js and followed this great tutorial on node.js at Howtonode, express and mongod. However, I seem to be getting an error that no one else commented on in the comments. The latest comment was about a month ago, so maybe the code is outdated?

The problem is that when I visit http://localhost:3000/, the page shows Internal Server Error and in the terminal, I get the error message below. Does anyone know what happened?

Here’s the error message:

TypeError: Object function (){} has no method 'findAll'
    at Router.<anonymous> (/Users/x/nodejs/howtonode/blog/app.js:30:18)
    at done (/Users/x/nodejs/howtonode/blog/node_modules/express/lib/router/index.js:250:22)
    at middleware (/Users/x/nodejs/howtonode/blog/node_modules/express/lib/router/index.js:244:9)
    at param (/Users/x/nodejs/howtonode/blog/node_modules/express/lib/router/index.js:227:11)
    at pass (/Users/x/nodejs/howtonode/blog/node_modules/express/lib/router/index.js:232:6)
    at Router._dispatch (/Users/x/nodejs/howtonode/blog/node_modules/express/lib/router/index.js:255:4)
    at Object.handle (/Users/x/nodejs/howtonode/blog/node_modules/express/lib/router/index.js:45:10)
    at next (/Users/x/nodejs/howtonode/blog/node_modules/express/node_modules/connect/lib/http.js:203:15)
    at Object.handle (/Users/x/nodejs/howtonode/blog/node_modules/stylus/lib/middleware.js:187:7)
    at next (/Users/x/nodejs/howtonode/blog/node_modules/express/node_modules/connect/lib/http.js:203:15)
TypeError: Object function (){} has no method 'findAll'
    at Router.<anonymous> (/Users/x/nodejs/howtonode/blog/app.js:30:18)
    at done (/Users/x/nodejs/howtonode/blog/node_modules/express/lib/router/index.js:250:22)
    at middleware (/Users/x/nodejs/howtonode/blog/node_modules/express/lib/router/index.js:244:9)
    at param (/Users/x/nodejs/howtonode/blog/node_modules/express/lib/router/index.js:227:11)
    at pass (/Users/x/nodejs/howtonode/blog/node_modules/express/lib/router/index.js:232:6)
    at Router._dispatch (/Users/x/nodejs/howtonode/blog/node_modules/express/lib/router/index.js:255:4)
    at Object.handle (/Users/x/nodejs/howtonode/blog/node_modules/express/lib/router/index.js:45:10)
    at next (/Users/x/nodejs/howtonode/blog/node_modules/express/node_modules/connect/lib/http.js:203:15)
    at Object.handle (/Users/x/nodejs/howtonode/blog/node_modules/stylus/lib/middleware.js:187:7)
    at next (/Users/x/nodejs/howtonode/blog/node_modules/express/node_modules/connect/lib/http.js:203:15)

app.js

var express = require('express');
var ArticleProvider = require('./articleprovider-memory').ArticleProvider;

var app = module.exports = express.createServer()

// Configuration
app.configure(function() {
    app.set('views', __dirname + '/views');
    app.set('view engine', 'jade');
    app.use(express.bodyParser());
    app.use(express.methodOverride());
    app.use(require('stylus').middleware({ src: __dirname + '/public' }));
    app.use(app.router);
    app.use(express.static(__dirname + '/public'));
});

app.configure('development', function() {
    app.use(express.errorHandler({ dumpExceptions: true, showStakc: true }));
});

app.configure('production', function() {
    app.use(express.errorHandler());
});

var articleProvider= new ArticleProvider();


// Routes
app.get('/', function(req, res) {
    ArticleProvider.findAll(function(error, docs) {
        res.send(docs);
    });
});

app.listen(3000);

article-provider-memory.js

var articleCounter = 1;

ArticleProvider = function(){};
ArticleProvider.prototype.dummyData = [];

ArticleProvider.prototype.findAll = function(callback) {
  callback( null, this.dummyData )
};

ArticleProvider.prototype.findById = function(id, callback) {
  var result = null;
  for(var i =0;i<this.dummyData.length;i++) {
    if( this.dummyData[i]._id == id ) {
      result = this.dummyData[i];
      break;
    }
  }
  callback(null, result);
};

ArticleProvider.prototype.save = function(articles, callback) {
  var article = null;

  if( typeof(articles.length)=="undefined")
    articles = [articles];

  for( var i =0;i< articles.length;i++ ) {
    article = articles[i];
    article._id = articleCounter++;
    article.created_at = new Date();

    if( article.comments === undefined )
      article.comments = [];

    for(var j =0;j< article.comments.length; j++) {
      article.comments[j].created_at = new Date();
    }
    this.dummyData[this.dummyData.length]= article;
  }
  callback(null, articles);
};

/* Lets bootstrap with dummy data */
new ArticleProvider().save([
  {title: 'Post one', body: 'Body one', comments:[{author:'Bob', comment:'I love it'}, {author:'Dave', comment:'This is rubbish!'}]},
  {title: 'Post two', body: 'Body two'},
  {title: 'Post three', body: 'Body three'}
], function(error, articles){});

exports.ArticleProvider = ArticleProvider;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T01:33:53+00:00Added an answer on May 27, 2026 at 1:33 am

    It’s your capitalization of ArticleProvider here in app.js:

    // Routes
    app.get('/', function(req, res) {
        ArticleProvider.findAll(function(error, docs) {
            res.send(docs);
        });
    });
    

    It should be:

    // Routes
    app.get('/', function(req, res) {
        articleProvider.findAll(function(error, docs) {
            res.send(docs);
        });
    });
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am just getting started with NHaml and ran into a snag. This is
I just started getting this error today, seemingly out of nowhere. Any one see
OK have just started getting this error and I'm not sure why. I have
I've just started getting into Node.js. I come from a PHP background, so I'm
I just started getting into BizTalk at work and would love to keep using
I just started getting into iPhone development. I have been mish-mashing tutorials and material
I'm just getting started developing for Android and I'm running into a weird problem.
So I am just getting started with this. New to .NET, SQL Server, C#,
I am learning OpenGL and just started getting into lighting. I enable lighting and
Greetings. I'm just getting started with the boost::asio library and have run into some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.