
import * as Hapi from 'hapi';
import { IRevApiOptions, RevApi } from './api/revapi';

let version = require('../package.json').version;

function RevApiPlugin(server: Hapi.Server, options: IRevApiOptions, next: any) {
    server.expose('version', version);
    server.expose('api', new RevApi(server, options));
    next();
}

(RevApiPlugin as any).attributes = {
    name: 'revApi',
    version: version
};

export default RevApiPlugin;


import * as Hapi from 'hapi';
import { IRevApiOptions, RevApi } from './api/revapi';

let version: string = null;

try {
    version = require('./package.json').version;
}
catch (e) {
    version = require('../package.json').version;
}

function RevApiPlugin(server: Hapi.Server, options: IRevApiOptions, next: any) {
    server.expose('version', version);
    server.expose('api', new RevApi(server, options));
    next();
}

(RevApiPlugin as any).attributes = {
    name: 'revApi',
    version: version
};

export default RevApiPlugin;

Fix issue with loading version from package.json
Fix issue with loading version from package.json
