Has no method set Error

253 views
Skip to first unread message

Alex Katebi

unread,
Aug 27, 2011, 3:04:08 PM8/27/11
to nod...@googlegroups.com
I have been trying to use "connect" and I always get some kind of error.
Below is an example:

Soure code is:

var connect = require('connect');
connect.createServer(function (req, res, next) {
  // Every request gets the same "Hello Connect" response.
  res.simpleBody(200, "Hello Connect");
}).listen(8080);


Error:

node.js:134
        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);
  app.stack = [];
  return app;
} has no method 'set'
    at Object.<anonymous> (/home/akatebi/test.js:6:9)
    at Module._compile (module.js:402:26)
    at Object..js (module.js:408:10)
    at Module.load (module.js:334:31)
    at Function._load (module.js:293:12)
    at Array.<anonymous> (module.js:421:10)
    at EventEmitter._tickCallback (node.js:126:26)



Richard Marr

unread,
Aug 31, 2011, 3:45:01 AM8/31/11
to nod...@googlegroups.com
>   res.simpleBody(200, "Hello Connect");

Could be a version problem... I think the "simpleBody" method was
removed about a year ago.

I'm on Node 0.4.7 and Connect 1.4.0 and your code snippet works fine
if I replace res.simpleBody(200, "Hello Connect") with res.end("Hello
Connect")

> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to nod...@googlegroups.com
> To unsubscribe from this group, send email to
> nodejs+un...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>

--
Richard Marr

Reply all
Reply to author
Forward
0 new messages