0.1.2 • Published 10 years ago

hapi-restify v0.1.2

Weekly downloads
11
License
-
Repository
github
Last release
10 years ago

Hapi-Restify

REST API with HAPI. Built from your Mongo models.

Installation

npm install hapi-restify

Use

var Restify = require('hapi-restify'),
    settings = require('./settings/settings');

var myApp = Restify.createApplication(
  settings,
  function () {
    myApp.start(); // Server is now listening at http://localhost:33000/
  }
);

Settings

The settings object given to Restify.createServer is the same as the one you would use with Hapi.createServer : See https://github.com/spumko/hapi/blob/master/docs/Reference.md#server-options

Restify custom settings are available in the app section of this object :

var path = require('path');
var settings = module.exports = {

  app: {
   host: 'localhost',
   port: 4242,

   // Mongo database settings
   db: {
     name: 'mydatabase',
     host: 'localhost',
     port: 27017
   },

   // Display options
   display: {
     // Default limit
     itemsPerPage: 9,
     maxItemsPerPage: 30 // ?limit=x&page=y
   },

   // Models directory
   models: { path: __dirname + '/../models/' },

   // Controllers directory
   controllers: { path: __dirname + '/../controllers' }

   // Custom settings can be added here
 },
 // Extra Hapi settings can be added here
 // cache: {}, auth: {}, ...
}
0.1.2

10 years ago

0.1.0

10 years ago

0.0.3

11 years ago

0.0.3-beta

11 years ago

0.0.3-alpha

11 years ago

0.0.2-beta

11 years ago

0.0.2-alpha

11 years ago

0.0.1

11 years ago

0.0.1-beta

11 years ago

0.0.1-alpha

11 years ago