1.0.3 • Published 6 years ago

@electricg/hapi-mongodb-server v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

hapi-mongodb-server

Basic API server made with hapi and MongoDB.

How to install

npm install @electricg/hapi-mongodb-server

How to use

A complete example is available in the example directory.

const api = require("@electricg/hapi-mongodb-server");

const port = 8083;
const host = "127.0.0.1";
const mongodbUrl = "mongodb://localhost:27017/test";
const mongodbOptions = {
  autoReconnect: true
};
const allowedOrigins = ["*"];
const routes = [
  {
    method: "GET",
    path: "/",
    handler: handler: () => {
      return { name: "test", version: "1.0.0" };
    }
  }
];

const settings = {
  db: {
    uri: mongodbUrl,
    options: mongodbOptions
  },
  server: {
    port: port,
    host: host,
    origin: allowedOrigins,
    routes: routes
  }
};

api.start(settings);
1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago