How to use glue - 10 common examples

To help you get started, we’ve selected a few glue 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 cypress-io / cypress-example-realworld / server / server / index.js View on Github external
exports.deployment = async start => {
  const manifest = Manifest.get('/')
  const server = await Glue.compose(
    manifest,
    { relativeTo: __dirname }
  )

  await server.initialize()

  // let's not include code coverage utility code in our coverage report
  // https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md
  /* istanbul ignore next */
  if (global.__coverage__) {
    console.log('registering coverage middleware')
    require('@cypress/code-coverage/middleware/hapi')(server)
  }

  if (!start) {
    return server
github iteles / learning / hapiedge / ch3-routes / index.js View on Github external
'./routes' : [{ 'select' : ['http'] }],
      './api' : [{ 'select' :['api'] }],
      
      good: {
        opsInterval: 5000,
        reporters: [{
          'reporter' : 'good-console',
          'events' : {'ops':'*', 'log':'*'}
        }]
      }
    } // closes plugins
  } // closes manifest
}; //end of internals

//brings everything together, compose(manifest, [options], callback)
Glue.compose(internals.manifest, { relativeTo: __dirname },
  function(err, server){
  
  if (err){
    console.log('server.register err: ', err);
  }
  
  server.start(function(){
    console.log('server started');
  });
  
});
github iteles / learning / hapiedge / ch2-server / index.js View on Github external
'./routes' : [{ 'select' : ['http'] }],
      './api' : [{ 'select' :['api'] }],
      
      good: {
        opsInterval: 5000,
        reporters: [{
          'reporter' : 'good-console',
          'events' : {'ops':'*', 'log':'*'}
        }]
      }
    } // closes plugins
  } // closes manifest
}; //end of internals

//brings everything together, compose(manifest, [options], callback)
Glue.compose(internals.manifest, { relativeTo: __dirname },
  function(err, server){
  
  if (err){
    console.log('server.register err: ', err);
  }
  
  server.start(function(){
    console.log('server started');
  });
  
});
github Esri / storymap-crowdsource / server.js View on Github external
var Glue = require('glue');
var Path = require('path');
var Config = require('./config');

var internals = {
  config: new Config()
};

internals.manifest = internals.config.server.manifest;
internals.rootPath = internals.config.server.staticPaths.root;
internals.buildPath = internals.config.server.staticPaths.build;

Glue.compose(internals.manifest, function(err, server) {

  if (err) {
    throw err;
  }

  if (internals.config.environment === 'dev') {

    // Path the build
    server.route({
      method: 'GET',
      path: '/' + internals.buildPath + '{param*}',
      handler: {
        directory: {
          path: internals.buildPath,
          listing: true
        }
github lawrips / redis-live / lib / app.js View on Github external
handlebars = require('handlebars'),
    extend = require('handlebars-extend-block');

require('./modules/monitor')

const manifest = require('../config/manifest.json');

var options = {
    relativeTo: __dirname + '/plugins'
};

manifest.connections[0].port = process.env.PORT || manifest.connections[0].port;
manifest.server.debug = { request: ['error'] }; 

debug('starting web server');
Glue.compose(manifest, options, (err, server) => {
    server.register([vision, Inert],
        (err) => {
            debug('plugins registered');
            if (err) throw err;
            // register handlebars for template handling
            server.views({
                engines: {
                    html: extend(handlebars),
                },
                path: 'views',
                layout: 'main',
                isCached: false,
                layoutPath: 'views/layouts',
                relativeTo: __dirname,
                compileOptions: {
                    pretty: true
github lawrips / whisper / lib / app.js View on Github external
var manifest = require('../config/manifest.json');

// get my modules
var log = require('./modules/services/loggingService');

var options = {
    relativeTo: __dirname + '/plugins'
};

// reigster helpers & partials
require('./plugins/register');

// port handling required for azure
manifest.connections[0].port = process.env.PORT || manifest.connections[0].port;

Glue.compose(manifest, options, (err, server) => {
    log.warning('glue startup complete');
    
    // start webserver
    server.start(function (err) {
        // server running on port 8082
        log.warning('whistle-ws started');
    });
    
    // handlebars templating engine
    server.register(vision, (err) => {
        if (err) {
            throw err;
        }

        server.views({
            engines: {
github gothinkster / hapijs-realworld-example-app / lib / index.js View on Github external
'user strict'

require('dotenv').config({path: process.cwd() + '/.secret'})

const Glue = require('glue')
const Labbable = require('labbable')

const labbable = module.exports = new Labbable()
const manifest = require('./config/manifest')

var options = {
  relativeTo: process.cwd() + '/lib/modules'
}

Glue.compose(manifest, options, (err, server) => {
  if (err) {
    throw err
  }

  // Step 2.
  // Show the server to our instance of labbable
  if (process.env.NODE_ENV === 'test') {
    labbable.using(server)
  }

  // Step 3.
  // Initialize your server
  server.initialize((err) => {
    if (err) {
      throw err
    }
github SystangoTechnologies / Hapiness-SQL / test / testcases / server.js View on Github external
it('composes a server using manifest', async () => {
		var server = await Glue.compose(Manifest.get('/'), composeOptions);
		context.request = supertest(server.listener);
		expect(server.info.port).to.equal(8000);
	});
});
github DefinitelyTyped / DefinitelyTyped / types / glue / glue-tests.ts View on Github external
server: {
    port: 3000
  },
  register: {
    plugins: [
      {
        plugin: "./test",
        routes: {
          prefix: "test"
        }
      }
    ]
  }
};

Glue.compose(manifest);
github SystangoTechnologies / Hapiness-SQL / server.js View on Github external
async function startServer () {
	try {
		var server = await Glue.compose(Manifest.get('/'), composeOptions);
		server.views({
			engines: {
				hbs: Handlebars
			},
			path: './app/templates',
			layoutPath: './app/templates/layouts',
			helpersPath: './app/templates/helpers',
			partialsPath: './app/templates/partials',
			layout: 'default'
		});
		await server.start();
		console.info(`Server started at ${server.info.uri}`);
	} catch (err) {
		console.error(err);
		process.exit(1);
	}

glue

Server composer for hapi.js

BSD-3-Clause
Latest version published 6 years ago

Package Health Score

45 / 100
Full package analysis

Popular glue functions