npm install YOUR_MAGISTRATE_URLconst init = async () => {
await server.register(require('inert'));
await server.register({
plugin: require('magistrate/hapi'),
options: {
credentials: {
host: 'localhost',
port: 5432,
user: 'postgres',
password: 'postgres',
database: 'sample',
},
// credentials: {
// connectionString: process.env.DATABASE_URL
// },
provider: 'rds',
prefix: '/magistrate',
authentication: false,
debug: true,
},
});
await server.start();
};Hapi Magistrate requires inert be loaded before Magistrate.
| Option | Type | Default | Description |
|---|---|---|---|
| credentials | Object | null | An object with a connectionString property or individual connection properties. |
| provider | String | '' | The database provider. One of: 'rds', 'heroku', or 'gcloud' |
| authentication | object | null | A Hapi.js route authentication object |
| debug | Boolean | false | Logs debug information to the stdout/stderr. |