<repo_name>ems-invirohub/kingAPI<file_sep>/Dockerfile
FROM node

MAINTAINER <NAME> <<EMAIL>>

ADD . usr/src/app

WORKDIR /usr/src/app

RUN npm install

EXPOSE 8080

CMD ["node", "server.js" ]<file_sep>/plugins/utils/plugin.js
'use strict';

exports.register = (server, option, next) => {

    server.route({

        method:    'GET',
        path:       '/utils',
        handler:   (request, reply) => reply('Testing Testing')
    });


    next();

};

exports.register.attributes = {name: 'routes-utils'};<file_sep>/config.js

let config = {};
config.rethink = {};
config.hapi = {};
config.remote = {};
config.billing = { };


//local
config.rethink.host = 'localhost';
config.rethink.port = 32769;
config.hapi.port = 3011;


module.exports = config;<file_sep>/routes.js
'use strict';

const routes = [].concat(

    require('./plugins/utils/plugin')

);

module.exports = routes;

<file_sep>/server.js
'use strict';

const Hapi        = require('hapi'),
      Hoek        = require('hoek'),
      r           = require('rethinkdb'),
      config      = require('./config'),
      goodOptions = require('./good-options');

const server = new Hapi.Server();


server.connection({ port: config.hapi.port, routes: {cors: true} });


const connectRethink = function(cb) {

    r.connect(config.rethink, (err, conn) => {
        if(err) {
            console.log(config.rethink);
            console.log(err.message);
        }
        cb(err, conn);
    });
};

const closeRethink = function(conn) {
    conn.close((err) => {
        if(err) console.error(err);
    });
};

server.method('rConnect', connectRethink);
server.method('rClose', closeRethink);

server.register(require('./routes'), (err) => {

    if(err){
        throw err;
    } else {

        server.start((err) => {
            Hoek.assert(!err, err);
            console.log(`Server listening at ${server.info.uri}`);
        });
    }
});

server.register({
    register: require('good'),
    goodOptions
});

