0

Here is my config.json code:

{
    "connections": [
        {
            "port": 3000
        }
    ],
    "registrations": [
        {
            "plugin": "./plugins/db"
        },
        {
            "plugin": "good",
            "options": {
                "reporters": {
                    "console": [
                        {
                            "module": "good-squeeze",
                            "name": "Squeeze",
                            "args": [
                                {
                                    "log": "*",
                                    "response": "*"
                                }
                            ]
                        },
                        {
                            "module": "good-console"
                        },
                        "stdout"
                    ]
                }
            }
        },
        {
            "plugin": "./routes/bookmarks"
        },
        {
            "plugin": "blipp"
        }
    ]
}

And server.js:

'use strict';

const Hapi = require('hapi');
const Glue = require('glue');

const manifest = require('./config.json');

const options = {
    relativeTo: __dirname
}

Glue.compose(manifest, options, (err, server) => {
    if (err) {
        throw err
    }

    server.start((err) => {
        if (err) {
            throw err
        }

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

The error I get:

/home/master/Documents/Hapi/starter/node_modules/hoek/lib/index.js:736 throw new Error(msgs.join(' ') || 'Unknown error'); ^

Error: Invalid register options { "reporters" [1]: { "console": [ { "module": "good-squeeze", "name": "Squeeze", "args": [ { "log": "*",

Any solution for this?

Vladimir Djukic
  • 925
  • 2
  • 9
  • 28

1 Answers1

0

To register the solution given here:

{
  "plugin": {
    "register": "good",
    "options": {
      "reporters": {
        "console": [
          {
            "module": "good-squeeze",
            "name": "Squeeze",
            "args": [
              {
                "log": "*",
                "response": "*"
              }
            ]
          },
          {
            "module": "good-console"
          },
          "stdout"
        ]
      }
    }
  }
}
Jonatas Walker
  • 13,583
  • 5
  • 53
  • 82