Skip to content

glennjones/hapi-workshop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hapi-workshop

This project contains the material created for Async Special - Hapi.js Workshop on 6th Dec 2014. The examples are still been updated, but should be of use to anyone learning about Hapi.

POST EVENT UPDATE

Code

API

This is a example bookmark API built with hapi. I am still updating and adding to this example.

There are also the staged builds from the workshop:

  1. bookmarks-api (routes, static assets)
  2. bookmarks-api (templates, handlers, database)
  3. bookmarks-api (plug-ins, documentation)

Authentication examples

There are 4 simple examples of the use of different authentication strategies.

Datebase connections examples

During the workshop a number of people ask about patterns of database connection for hapi. So I have created two examples projects to show approaches. The shared-connection is my favoured approch, but maybe built using promises.

Logging examples

During the workshop I showed logging of requests information using uses the good and good-console plug-ins. I have created simple examples of how to add these plug-ins to your project.

Prerequisites for running code

I wrote a prerequisites document on the software need to run the code and some tools that would help you build and debug the projects. If you wish to run these examples please read this first.

Workshop notes

I started writing some workshop notes, but did not finnsh them in time for the workshop. I have kept them in the project for reference. If your looking for good tutorials try (hapi site)[http://hapijs.com/tutorials], rather than these notes.

  1. Setup Node.js server with HAPI.js
  2. Serving static files and templates

TODO list

Expand on these subjects:

  • Share-code or singleton pattern in modules
  • Middleware and hapi
  • Export vs module.exports
  • The importants of HTTPS
  • Deploying app

Build examples of:

  • Update to v0.8.x of hapi
  • Share-code or singleton pattern in modules
  • Shared schema's across application layers
  • Using server.ext events for middleware like functionally
  • Locking endpoints and routes to HTTPS or HTTP
  • Update whole project with promises

This is a work in progress

If you find any issue please file here on github and I will try and fix them. If you are considering sending a pull request please add tests for the functionality you add or change.