hapi-boilerplate
v0.0.1
Published
Hapi.js boilerplate
Downloads
5
Maintainers
Readme
hapi-boilerplate
Hapi.js boilerplate
Installation
Download node at nodejs.org and install it, if you haven't already.
npm install hapi-boilerplate --save
Tests
npm install
npm test
Build (production)
npm build
Start (production)
npm start --production
Development
npm run watch # run build and continously watch files for changed and rebuild
npm run server # run server and auto reload when file change
npm run mocha # run all test cases (lighter than "npm test")
Project structure
└ project
├ src/ # <-- Directory contains all source code
| |
| ├ components/ # <-- Directory contains all helpers/utilities
| | # which don't depend on hapi.js
| | |
| | ├ config.js # <-- Helper to load config from config.js file and
| | | # parse base on NODE_ENV environment variable.
| | | # Using confidence.
| | |
| | ├ knex.js # <-- Return an instance of knex.
| | |
| | ├ orm.js # <-- Simple module to wrap bookshelf Model to
| | | # provide some utilities functions like
| | | # validation.
| | |
| | ├ redis.js # <-- Return an instance of redis. Also provide
| | | # promise interface.
| | |
| | ├ resolveAllOf.js # <-- Helper to resolve "allOf" in json schema.
| | |
| | └ ...
| |
| ├ controllers/ # <-- Directory contains all controllers (hapi
| | # handler functions)
| |
| ├ db/ # <-- Directory contains db configuration,
| | | # migrations, seed files to work with both
| | | # application and knex command line.
| | |
| | ├ migrations/ # <-- Directory contains migration files. Read
| | | # knex.js docs for more information.
| | |
| | ├ seeds/ # <-- Directory contains seed files. Read knex.js
| | | # docs for more information.
| | |
| | └ knexfile.js # <-- knex configuration file. Read knex.js docs
| | # for more information.
| |
| ├ models/ # <-- Directory contains all models.
| |
| ├ modules/ # <-- Directory contains all modules which work
| | | # as hapi.js plugin
| | |
| | ├ apiLoader.js # <-- Loader swagger config and generate hapi.js
| | | # route config.
| | |
| | ├ asyncHandler.js # <-- Hapi.js plugin to help write route handlers
| | | # using async/await more naturally.
| | |
| | └ ...
| |
| ├ schemas/ # <-- Directory contains schemas of api & models.
| | |
| | ├ api.swagger.yaml # <-- Root api file, defines all routes here.
| | |
| | ├ common.yaml # <-- Include common parameters for api.
| | |
| | └ models/ # <-- Directory contains all models definitions.
| | |
| | ├ common.yaml # <-- Include common properties for all models.
| | |
| | └ ...
| |
| ├ config.js # <-- Application config file, using "confidence".
| |
| ├ index.js # <-- Application entry, contains "main" function,
| | # load hapi.js server(with plugins) and start.
| |
| └ routes.js # <-- Mapping from swagger operationId to handler
| # method in controllers.
|
├ test/ # <-- Directory contains all test files. (Files
| | # with name "*.spec.js" will be run when test)
| |
| ├ common/ # <-- Directory contains some helpers included
| | # in many test cases.
| |
| └ ...
|
├ scripts/ # <-- Directory contains webpack build scripts.
| | # (Some advanced & confusing shit.)
| |
| └ ...
|
├ lib/ # <-- Auto generated directory contains compiled
| # library to use in production.
|
├ build/ # <-- Auto generated directory contains compiled
| # artifacts for test & dev.
|
├ coverage/ # <-- Auto generated directory contains code
| # coverage information.
|
├ .babelrc # <-- Babel configuration file.
|
├ .eslintignore # <-- ESLint ignore file.
|
├ .eslintrc # <-- ESLint configuration file.
|
├ index.js # <-- Entry file. Load in build if NODE_ENV is
| # "development" or lib if NODE_ENV is "production"
|
├ package.json # <-- npm configuration file. Contains magic.
|
├ README.md # <-- This stupid file.
|
└ ...
Dependencies
- bluebird: Full featured Promises/A+ implementation with exceptionally good performance
- bookshelf: A lightweight ORM for PostgreSQL, MySQL, and SQLite3
- boom: HTTP-friendly error objects
- confidence: Configuration API
- good: Server and process monitoring plugin
- good-console: Console broadcasting for Good process monitor
- hapi: HTTP Server framework
- hapi-swaggered-ui: Easy swagger-ui drop-in plugin for hapi to be used with hapi-swaggered.
- inert: Static file and directory handlers plugin for hapi.js
- joi: Object schema validation
- knex: A batteries-included SQL query & schema builder for Postgres, MySQL and SQLite3 and the Browser
- lodash: Lodash modular utilities.
- mysql: A node.js driver for mysql. It is written in JavaScript, does not require compiling, and is 100% MIT licensed.
- redis: Redis client library
- source-map-support: Fixes stack traces for files with source maps
- sqlite3: Asynchronous, non-blocking SQLite3 bindings
- swagger-parser: Swagger 2.0 parser and validator for Node and browsers
- uuid: Rigorous implementation of RFC4122 (v1 and v4) UUIDs.
- vision: Templates rendering plugin support for hapi.js
Dev Dependencies
- babel-cli: Babel command line.
- babel-core: Babel compiler core.
- babel-eslint: Custom parser for ESLint
- babel-loader: babel module loader for webpack
- babel-plugin-add-module-exports: Fix babel/babel#2212
- babel-plugin-istanbul: A babel plugin that adds istanbul instrumentation to ES6 code
- babel-plugin-lodash: Modular Lodash builds without the hassle.
- babel-preset-node6: Babel preset for Node 6.x (ES6 / ES2015)
- babel-preset-stage-2: Babel preset for stage 2 plugins
- bugger: Chrome Devtools Agents for node.js
- chai: BDD/TDD assertion library for node.js and the browser. Test framework agnostic.
- chai-as-promised: Extends Chai with assertions about promises.
- concurrently: Run commands concurrently
- eslint: An AST-based pattern checker for JavaScript.
- eslint-config-airbnb: Airbnb's ESLint config, following our styleguide
- eslint-plugin-import: Import with sanity.
- eslint-plugin-jsx-a11y: A static analysis linter of jsx and their accessibility with screen readers.
- eslint-plugin-react: React specific linting rules for ESLint
- forever: A simple CLI tool for ensuring that a given node script runs continuously (i.e. forever)
- json-schema-loader: Webpack loader that resolves Json Schema references.
- mocha: simple, flexible, fun test framework
- nyc: the Istanbul command line interface
- source-map-support: Fixes stack traces for files with source maps
- webpack: Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jade, coffee, css, less, ... and your custom stuff.
- webpack-node-externals: Easily exclude node_modules in Webpack bundle
License
MIT
Generated by package-json-to-readme