sad

    1.0.8 • Public • Published

    sad

    A Hapi.js Plugin to add X-Clacks-Overhead: GNU Terry Pratchett header to your projects.

    Build Status Code Climate Test Coverage Dependencies Node version HAPI 8.2 NPM Version

    Why?

    On Thursday 12th March 2015 Terry Pratchett passed away.
    This little Hapi.js Plugin keeps him alive "in the code".

    “We keep that name moving in the Overhead,” he said, and it seemed to
    Princess that the wind in the shutter arrays above her blew more forlornly,
    and the everlasting clicking of the shutters grew more urgent.
    “He’d never have wanted to go home. He was a real linesman.
    His name is in the code, in the wind in the rigging and the shutters.
    Haven’t you ever heard the saying: ‘A man’s not dead while his name is still spoken’?

    Even if you are not a Fan of Terry's work, I highly recommend watching the Documentary

    What?

    This node module (Hapi.js plugin) simply adds the "GNU Terry Pratchett" header
    to all out-going http replies in you Hapi.js Web App/Site.

    Usage

    Install from NPM

    npm install sad --save

    Register the Plugin in your Server

    in your server.js (or what ever you prefer to name it)

    var Hapi   = require('hapi');
    var server = new Hapi.Server();
    var PORT   = process.env.PORT || 8000;
     
    server.connection({ port: PORT });
     
    server.register([ { register: require('sad') } ], function (err) {
     
      server.route({
          method: 'GET',
          path: '/',
          handler: function (request, reply) {
              reply(“We will miss you Terry”);
          }
      });
    });
     
    server.start(function(){
      console.log('Now Visit: http://localhost:'+PORT);
    });
     
    module.exports = server;
     

    Confirm its Working

    Run your server in your usual way e.gx:

    node server.js

    Then check that its working by issuing the following curl command:

    curl -I http://127.0.0.1:8000/

    You should expect to see something like this:

    X-Clacks-Overhead: GNU Terry Pratchett
    content-type: text/html; charset=utf-8
    cache-control: no-cache
    Date: Tue, 17 Mar 2015 10:04:32 GMT
    Connection: keep-alive

    The first line is the important one.

    Further Reading

    http://www.reddit.com/r/bestof/comments/2yyop7/rdiscworld_redditors_with_web_servers_start/">this

    Keywords

    Install

    npm i sad

    DownloadsWeekly Downloads

    1

    Version

    1.0.8

    License

    ISC

    Last publish

    Collaborators

    • nelsonic