🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

docpad-plugin-hapi

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

docpad-plugin-hapi

A fully customizable Hapi server for Docpad.

2.4.2
latest
Source
npm
Version published
Weekly downloads
42
180%
Maintainers
1
Weekly downloads
 
Created
Source

Hapi Server Plugin for DocPad

A fully customizable Hapi server for docpad.

Usage (more coming soon)

In docpad.coffee or docpad.js, you can directly add routes as specified in Hapi Documentation

Hapi plugins can easily be loaded. Plugins can access docpad through server.app.docpad. For example, to get docpad configuration, server.app.docpad.getConfig() or in the router request.server.app.docpad.getConfig()

Also, server configuration can be overriden with the 'config' key

# Require Joi for route validation
Joi = require('joi');

# Docpad Configuration Object
module.exports = {
    plugins:
        hapi:
            # router
            routes: [
                {
                    method: 'POST'
                    path: '/test'
                    handler: (request, reply) ->
                        reply('test');
                    config:
                        validate:
                            payload:
                                test: Joi.string().min(3).max(8)
                },
                {
                    method: 'PUT'
                    path: '/hello'
                    handler: (request, reply) ->
                        reply('hello');
                }
            ]
            # server plugins
            plugins: [
                {
                    good:
                        require: 'good',
                        options:
                            subscribers:
                                console: ['request', 'log', 'error']
                },
                {
                    yar:
                        require: 'yar',
                        options:
                            cookieOptions:
                                password: 'password'
                },
                    customPlugin:
                        require: './lib/customPlugin',
                        options:
                            cookieOptions:
                                password: 'password'
            ]
            # server config
            config:
                maxSockets: 2000
            # clean urls
            defaultExtension: 'html' # default value. Specify another extension if desired.

Clean URLs

Clean URLs are enabled by default for files with .html extension. To change Clean URL extension, set plugin settings property "defaultExtension"

Deploying to Heroku or other Cloud Hosting

Change Procfile to

web: node_modules/docpad-plugin-hapi/bin/docpad-hapi-server

Running with pm2 or forever

forever start node_modules/docpad-plugin-hapi/lib/bin/docpad-hapi-server.js

License

Licensed under the incredibly permissive MIT License

Keywords

docpad

FAQs

Package last updated on 26 Mar 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts