How to use hapi - 10 common examples

To help you get started, we’ve selected a few hapi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github academia-de-codigo / noire-server / test / plugins / views.js View on Github external
it('registers the vision plugin', async () => {
        // setup
        server = Hapi.server();
        server.register(Logger);

        // exercise
        await server.register(Views);

        // validate
        expect(server.registrations.vision).to.be.an.object();
        expect(server.decorations.toolkit).to.contains('view');
    });
github KleeGroup / focus-core / example / api / server.js View on Github external
var hapi = require('hapi');
var routes = require('./routes');

var config = {cors: true};//, docs: true };
var server = new hapi.Server('localhost', 7777, config); // 8080 is the port to listen on

server.route(routes);

server.start(function() {
	console.log('Server started at: ' + server.info.uri);
});
github dwyl / learn-qunit / lib / static-server.js View on Github external
var Hapi   = require('hapi');
var server = new Hapi.Server();
var port   = process.env.PORT || 5000; // let heroku or env set port number
server.connection({ port: port });
server.route([{ method: '*', path: '/{param*}', handler: { directory: { path: __dirname +'/../' } } } ]);
server.start(function() { console.log('Static Server Listening on: http://127.0.0.1:' +port) });
github simov / grant / test / consumer / util / client.js View on Github external
hapi: (config, port) => new Promise((resolve) => {
    var grant = Grant.hapi()(config)

    var server = new Hapi.Server()
    server.connection({host: 'localhost', port})
    server.route({method: 'GET', path: '/', handler: callback.hapi})

    server.register([
      {register: grant},
      {register: yar, options: {cookieOptions:
        {password: '01234567890123456789012345678912', isSecure: false}}}
    ],
    () => server.start(() => resolve({grant, server})))
  }),
  'hapi-prefix': (config, port) => new Promise((resolve) => {
github christophercliff / flatmarket / packages / flatmarket-hapi / __test__ / index.spec.js View on Github external
beforeEach(function () {
        server = new Hapi.Server({ debug: false })
        server.connection({
            host: HOSTNAME,
            port: PORT,
        })
    })
github atomantic / hapi-and-healthy / test / warn.noProc.js View on Github external
before('start server', function (done) {
        server = new Hapi.Server();
        server.connection({
            port: 3192
        });
        done();
    });
github atomantic / hapi-and-healthy / test / healthy.noProc.js View on Github external
before('start server', function (done) {
        server = new Hapi.Server();
        server.connection({
            port: 3192
        });
        done();
    });
github leadgumshoe / boomstick / test / index.js View on Github external
lab.beforeEach(function(done){
    server = new hapi.Server();
    server.connection();
    server.route(routes);
    done();
  });
github genediazjr / acquaint / test / loadHandlers.js View on Github external
beforeEach((done) => {

        server = new Hapi.Server();
        server.connection();

        return done();
    });
github genediazjr / acquaint / test / loadMethods.js View on Github external
beforeEach((done) => {

        server = new Hapi.Server();
        server.connection();

        return done();
    });

hapi

HTTP Server framework

BSD-3-Clause
Latest version published 6 years ago

Package Health Score

40 / 100
Full package analysis