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

  • SEARCH
  • Home
  • 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 7823483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T08:15:44+00:00 2026-06-02T08:15:44+00:00

I use the nodejs connent modul code for sample. app.js follow this: var connect

  • 0

I use the nodejs connent modul code for sample. app.js follow this:

var connect = require("connect");

connect(
  connect.static(__dirname + "/public"),
  // create a router to handle application paths
  connect.router(function(app) {
    app.get("/sayHello/:firstName/:lastName", function(req, res) {
      var userName = req.params.firstName + " " + req.params.lastName,
        html = "<!doctype html>" + "<html><head><title>Hello " + userName + "</title></head>" + "<body><h1>Hello, " + userName + "!</h1></body></html>";

      res.end(html); 
    });
  }) 
).listen(8000);

node app.js excute its, print error message on console of this:

node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
TypeError: Object function createServer() {
  function app(req, res){ app.handle(req, res); }
  utils.merge(app, proto);
  utils.merge(app, EventEmitter.prototype);
  app.route = '/';
  app.stack = [].slice.apply(arguments);
  return app;
} has no method 'router'
    at Object.<anonymous> (/Users/yangzhaojie/tech/nodejs/devsample/app4.js:6:10)
    at Module._compile (module.js:441:26)
    at Object..js (module.js:459:10)
    at Module.load (module.js:348:31)
    at Function._load (module.js:308:12)
    at Array.0 (module.js:479:10)
    at EventEmitter._tickCallback (node.js:192:40)

os: Mac OS X Lion 10.7.3

node: 0.6.11

connent: 2.1.3

  • 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-06-02T08:15:46+00:00Added an answer on June 2, 2026 at 8:15 am

    You must be using an old tutorial or something. The router middleware was removed from Connect some time ago: https://github.com/senchalabs/connect/issues/262

    You can either use another module like this one (connect-router) or switch to Express.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

after install Express.js, I wrote this on node: var express = require('express'), app =express.createServer();
I have nodejs application with mongodb(mongoose). like this: var mongoose = require('mongoose'); var express
var mysql = require('mysql'); var client = mysql.createClient({ user: 'myusername', password: 'mypassword', }); client.query('USE
I installed nodejs and socket.io, and when I run the demo code at http://socket.io/#how-to-use
If I use gcore to make a code dump of a Node.js process, what
A web app I am writing in JavaScript using node.js. I use Foreman, but
For the past 6 months, I've been working on my own nodeJS app, where
The follow code should (i thought) populate the dd field in schema A but
I'm trying to setup a nodejs project to use requirejs. I call my program
I want a TreeView with checkboxes and I'm trying to follow this tutorial .

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.