In the previous video, we had created a basic Hapijs Elapsed time plugin which calculates the elapsed time from the request coming in to when the response has been fully sent.
This video picks up where we left off and dresses up the plugin with a few more fields that would be nice to have in that log message so we could use them for analysis.
We will add a failing test and them implement the feature for each of the following properties:
- request ID
- HTTP method
- HTTP response status code
- HTTP response headers
Using Mocha‘s watch feature, you can see how it is easy to bounce back and forth creating tests and implementing the feature without having to leave our editor.
At the end of this video, we have a fully functional Hapijs Elapsed time plugin.
- Iterate on: id, method, url, status, and headers features
- adding failing tests
- implement features
- Episode: CW V005
- Skill level: Beginner with basic Node.js skills
- Basic Node.js & npm
- Basic Mocha test runner knowledge
- Basic Chai assertion library knowledge
- Published: May 8th, 2014
- Tags: js, nodejs,hapi,plugin,free
- Duration: 8:01
- Node.js version: 0.10.25
- Git version: 126.96.36.199
- We will use a test driven development approach to building our plugin
In the next video
- Create a repo on github
- Push local repo to github
- Test npm installing from github