Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/firstandthird/hapi-robots
Hapi plugin for serving up robots.txt
https://github.com/firstandthird/hapi-robots
hapi-plugin hapi-v17
Last synced: 14 days ago
JSON representation
Hapi plugin for serving up robots.txt
- Host: GitHub
- URL: https://github.com/firstandthird/hapi-robots
- Owner: firstandthird
- License: mit
- Created: 2016-08-22T16:11:45.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2021-02-19T01:43:15.000Z (almost 4 years ago)
- Last Synced: 2025-01-11T00:45:12.039Z (22 days ago)
- Topics: hapi-plugin, hapi-v17
- Language: JavaScript
- Size: 33.2 KB
- Stars: 0
- Watchers: 6
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# 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