Skip to content

Latest commit

 

History

History
46 lines (35 loc) · 1.29 KB

README.md

File metadata and controls

46 lines (35 loc) · 1.29 KB

Hapi.js application skeleton

This repo has not intent to be a framework, this is just a proposed structure of an app with Hapi.js.

Folder structure

  • models
  • routes
  • contollers
  • validators
  • plugins
  • test
  • docs

Integration with Hapi.js plugins

  • Swagger plugin
  • Good console reporter plugin
  • TV plugin
  • Lab testing plugin
  • Joi Validator plugin

NPM scripts

  • run: npm start
  • testing: npm test
  • code coverage: npm run coverage
  • check deps: npm run deps
  • check outdated deps: npm run outdated
  • code linting: npm run lint

Environment Variables and default values

  • PORT=3000
  • GOOD_CONSOLE=log,response,request,error
  • SWAGGER_URI=http://localhost:3000
  • NODE_ENV=development
  • TV_DEBUG=1 (0 disable plugin)
  • LOG_LEVEL=INFO

Other Notes

  • config.js just initialize variables with env vars if these exist or default values if not exists
  • Code linting is done by JSHint and right now just has the basic configuration into .jshintrc
  • Git exclude javascript IDE's, Node and OSX auto-generated files and are mostly not desirables in your repo, check ``.gitignore` is generated by https://goel.io/joe
  • npm start load the index.js with PM2 module and is mostly used on production environment if you are on development stage just hit: node index.js