UNPKG

vikings-cli

Version:

Vikings services project generator

54 lines (43 loc) 1.2 kB
const fs = require('fs'); const path = require('path'); const IgnitionService = require('vikings-ignition').IgnitionService; const config = require('./config'); var pino = require('pino'); let pretty = pino.pretty(); pretty.pipe(process.stdout); pino = pino({ name: '[pROJECT_NAME]', safe: true }, pretty); class [PROJECT_NAME] extends IgnitionService { constructor(options) { options.name = '[pROJECT_NAME]'; super(options); process.on('SIGINT', () => { this._destroy(); setTimeout( () => { console.log('died on SIGINT'); process.exit(); }, 500); }); process.on('SIGTERM', () => { this._destroy(); setTimeout( () => { console.log('died on SIGTERM'); process.exit(); }, 500); }); // waiting for service deployment on web server side this.on('readyToRegister', () => { // register methods and then deploy them this._registerMethods(); pino.info('Service ' + this._name + ' declaration done with options', options); }); } fct1(args) { return new Promise( (resolve, reject) => { resolve({}); }); } } let migrant = new [PROJECT_NAME](config);