hapi-robots

3.2.2 • Public • Published

hapi-robots

Hapi plugin for serving up robots.txt

installation

'npm install hapi-robots'

usage

const Hapi = require('hapi');
const hapiRobots = require('hapi-robots');

server = new Hapi.Server();
server.connection();
server.register({
  register: hapiRobots,
  options: {
    .........
  }
});

where options is an object of the form:

{
  // set to true to use server.log to report info about robots.txt and remote attempts to access it:
  debug: false,
  envs: {
    production: {
      // will disallow *all* robots from the path '/noDroidsAllowed':
      '*': ['/noDroidsAllowed'],
      // will disallow robot 'R2D2' from the indicated paths:
      'R2D2': ['/noDroidsAllowed', '/noR2D2Here']
    },
    stage: {
      // will disallow everyone from every path:
      '*': ['/'],
      // except for chuck, chuck is awesome:
      'chuck': []
    },
    // use '*' to match match any other env that isn't listed above:
    '*': ['/']
  },
  // tell hapi-robots which of the above envs to use:
  env: 'production'
}

see folder /test for more examples

Readme

Keywords

Package Sidebar

Install

npm i hapi-robots

Weekly Downloads

317

Version

3.2.2

License

MIT

Unpacked Size

16.4 kB

Total Files

12

Last publish

Collaborators

  • jga
  • dawnerd
  • ecwillis
  • orthagonal1
  • alaguna
  • aleperez92