Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
before(async () => {
server = await Glue.compose(serverConfig.manifest, options);
const res = await server.inject({
url: `/`,
method: 'get'
});
const header = res.headers['set-cookie'];
// ref: https://github.com/hapijs/crumb/blob/master/test/index.js#L134
cookie = header[0].match(/crumb=([^\x00-\x20\"\,\;\\\x7F]*)/);
});
exports.deployment = async (start) => {
const manifest = Manifest.get('/', process.env);
const server = await Glue.compose(manifest, { relativeTo: __dirname });
await server.initialize();
// $lab:coverage:off$
if (!start) {
return server;
}
await server.start();
console.log(`Server started at ${server.info.uri}`);
return server;
};
exports.start = async function(plugins) {
ConfigValidation.validate(Config);
// create a new hapi server
const server = await Glue.compose(
internals.buildManifest(plugins),
{
relativeTo: internals.pluginsPath
}
);
Hoek.assert(server.settings.app, 'server settings should not be empty');
// get the server name
const connection = server.settings.app.name;
Hoek.assert(connection, 'server requires a name setting');
// create a new exiting manager for all the hapi servers
internals.manager = Exiting.createManager(server);
await internals.manager.start();
const startServer = async function () {
try {
const server = await Glue.compose(serverConfig.manifest, options);
await server.start();
console.log(`Server listening on ${server.info.uri}`);
}
catch (err) {
console.error(err);
process.exit(1);
}
};
const main = async function () {
const options = { relativeTo: __dirname };
const server = await Glue.compose(Manifest.get('/'), options);
await server.start();
console.log(`Server started on port ${Manifest.get('/server/port')}`);
};