Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
'./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');
});
});
'./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');
});
});
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
}
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
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: {
'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
}
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);
});
});
server: {
port: 3000
},
register: {
plugins: [
{
plugin: "./test",
routes: {
prefix: "test"
}
}
]
}
};
Glue.compose(manifest);
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);
}