proofgeist / hapi-fm-rest

RESTFul JSON API Server for FileMaker
5 stars 0 forks source link

Need help to install with recent version of HAPI #10

Open jsg10 opened 6 years ago

jsg10 commented 6 years ago

I want to try this plugin in recent version of HAPI with the official tour. But I can't make it run at all.

This is my server.js file:


'use strict';

const Hapi = require('hapi');
const fmrest = require('hapi-fm-rest');

const server = Hapi.server({
    port: 3000,
    host: 'localhost'
});

//if FileMaker Server is on a different server change "localhost" to the url of the server
//Or pass it in as environment variable
const FMS_SERVER_ADDRESS = process.env.FMS_SERVER_ADDRESS ? process.env.FMS_SERVER_ADDRESS : 'localhost';

// we need to the know name of the primary key in the database
// currently we only support one name, so all primary keys need to be have the same name.
const ID_FIELD = 'id';

const init = async () => {

    await server.register({
        plugin: require('hapi-fm-rest'),
        options: {
            fmsAddress : FMS_SERVER_ADDRESS,
            idField : ID_FIELD
        }
    });

    await server.start();
    console.log(`Server running at: ${server.info.uri}`);
};

process.on('unhandledRejection', (err) => {

    console.log(err);
    process.exit(1);
});

init();

What's wrong with this code ?

Please Help.

Thank you.

jsg10 commented 6 years ago

@toddgeist