A man is not dead while his name is still spoken. Add an 'X-Clacks-Overhead' Header to your vanilla Node or Express app.
See http://www.gnuterrypratchett.com
- Install with npm or download and create your own module.
npm install node-gnu-clacks --save
- Import the module and tell your app to use as middleware:
const { node: gnuHeaderNode } = require('node-gnu-clacks');
const { express: gnuHeaderExpress } = require('node-gnu-clacks');
note: you can also use const gnuHeader = require('node-gnu-clacks');
for express apps for backwards compatibility with v1.
string[] ghosts = ['Terry Pratchett']
Add an array of names to be passed. This is in addition to the default, 'Terry Pratchett', which will always be added.
const http = require('http');
const { node: gnuHeaderNode } = require('node-gnu-clacks');
http
.createServer((req, res) => {
const addClacksHeader = gnuHeaderNode(['Moist', 'Adora', 'Reacher']);
addClacksHeader(res);
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('A man is not dead while his name is still spoken.\n');
})
.listen(3000);
const express = require('lib/express');
const { express: gnuHeaderExpress } = require('node-gnu-clacks');
const app = express();
app.use(gnuHeaderExpress());
or;
app.use(gnuHeaderExpress(['Moist', 'Adora', 'Reacher']));
app.get('/', (req, res) => {
res.send('A man is not dead while his name is still spoken.');
});
app.listen(3000);