nuxt-modules / robots

Tame the robots crawling and indexing your Nuxt site.
https://nuxtseo.com/robots
412 stars 30 forks source link

res.send is not a function #2

Closed kmelve closed 6 years ago

kmelve commented 6 years ago

Followed the installation instructions and got this message:

this.addServerMiddleware({
    path: 'robots.txt',
    handler(req, res) {
      res.setHeader('Content-Type', 'text/plain');
      res.send(renderedRobots);
    },
  });
};

I'm on "nuxt": "^1.0.0-rc11"

noelbautista91 commented 6 years ago

I am getting the same issue, same version of nuxt

edit:

If it's any consolation, a hack you can do is add a guard for res.send like so:

this.addServerMiddleware({
    path: 'robots.txt',
    handler(req, res) {
      res.setHeader('Content-Type', 'text/plain');
      if (res.send) res.send(renderedRobots);
      else res.end(renderedRobots);
    },
  });
};
WilliamDASILVA commented 6 years ago

Fixed in 1.2.0