Socket
Socket
Sign inDemoInstall

@mixmaxhq/express-robots

Package Overview
Dependencies
0
Maintainers
29
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mixmaxhq/express-robots


Version published
Maintainers
29
Created

Changelog

Source

1.0.0 (2019-12-12)

⚠ BREAKING CHANGES

  • The main export now returns an express router instead of an express application.

Bug Fixes

  • use express router instead of application (b07fa43)

Readme

Source

express-robots

Express middleware for generating a robots.txt or responding with an existing file.

Using a file

app.use(robots(__dirname + '/robots.txt'));

Using an object

Basic object

app.use(robots({UserAgent: '*', Disallow: '/'}))
Will produce:
UserAgent: *
Disallow: /

Crawl Delay

You can optionally pass a CrawlDelay in just like passing in Disallow

app.use(robots({UserAgent: '*', Disallow: '/', CrawlDelay: '5'}))
Will produce:
UserAgent: *
Disallow: /
Crawl-delay: 5

Or an array of objects

app.use(robots([
  {
    UserAgent: 'Googlebot',
    Disallow: '/no-google'
  },
  {
    UserAgent: 'Bingbot',
    Disallow: '/no-bing'
  }
]));
Will produce:
UserAgent: Googlebot
Disallow: /no-google
UserAgent: Bingbot
Disallow: /no-bing

Or either property (UserAgent | Disallow) as an array

app.use(robots([
  {
    UserAgent: [ 'Googlebot', 'Slurp' ],
    Disallow: [ '/no-google', '/no-yahoo' ]
  },
  {
    UserAgent: '*',
    Disallow: [ '/no-bots', '/still-no-bots' ]
  }
]));
Will produce:
UserAgent: Googlebot
UserAgent: Slurp
Disallow: /no-google
Disallow: /no-yahoo
UserAgent: *
Disallow: /no-bots
Disallow: /still-no-bots

Keywords

FAQs

Last updated on 12 Dec 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc