Skip to content

A base Hapi.js UI application for Node.js using Handlebars for server side and client side to consume APIs from other applications.

License

Notifications You must be signed in to change notification settings

joshpeyton/hapi-app-ui

Repository files navigation

Hapi App UI

This is a base Hapi.js UI application for Node.js using Handlebars for server side and client side to consume APIs from other applications.

Assumptions

Important

  • Node >=14 installed (Codebase updated using v14.17.4)
  • NPM >=6 installed

Code Quality

  • Have IDE plugins installed for jshint, eslint, editorconfig

Stack

  • Hapi - Server side framework
  • Handlebars - HTML templating engine for server side and client side
  • LESS - CSS preprocessor
  • Gulp - Tasks automation

Note: For a detailed list of the toolsets used, please refer to package.json.

Application Structure

| -- server
|    |-- app
|        |-- handlers       // All application handlers
|        |-- methods        // All application methods
|        |-- routes         // All application routes
|        |-- views          // All server-rendered handlebar templates, partials and helpers
|        |   |-- helpers    // Handlebar helpers
|        |   |-- partials   // Handlebar partials
|        |   |-- templates  // Handlebar templates
|        |-- index.js       // Setup for views
|
|    |-- app-services
|    |   |-- index.js       // Setup for services consumed
|   
|-- client                  // Contains all front end resources that gulp will compile to /dist folder
|   |-- js                  // Client javscript files
|   |-- less                // All LESS stylesheets
|   |-- templates           // All client-rendered handlebar templates and partials
|   
|-- tests                   // Unit tests
|
|-- build.json              // Build configuration for Gulp tasks
|-- gulpfile.js             // Gulp tasks file 
|-- index.js                // Application starting point
|-- manifest.js             // App manifest file listing all plugins, global settings and variables
|-- package.json            // Package configuration file
|-- server.js               // Main server file

Running the server locally

  • Install node, npm
  • Commands
# Install dependencies
$ npm install

# Generate client assets
$ npm run gulp

# Run the node server
$ npm start

# Run the node server in dev mode (gulp watching js,less,templates and nodemon watching server changes)
$ npm run dev

The server should be running at localhost:3000.

Running tests

Lab is part of the hapi.js toolset and used to write all of our tests.

$ npm test          // runs lab tests in console for passing/failing/coverage/etc
$ npm run coverage  // runs lab tests while creating and opening a coverage.html file

About

A base Hapi.js UI application for Node.js using Handlebars for server side and client side to consume APIs from other applications.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •