pashariger / Testing Hapi
Hapi style guide compliant boilerplate (updated to v17!)
Stars: ✭ 90
Programming Languages
javascript
184084 projects - #8 most used programming language
Projects that are alternatives of or similar to Testing Hapi
Hapi Starter Kit
Hapi.js based REST boilerplate which uses latest ES7/ES8 features (async/await) with code coverage and follows best pratices
Stars: ✭ 103 (+14.44%)
Mutual labels: swagger, eslint, hapi, boilerplate, travis-ci
Iceberg
Front-End Boilerplate built with React + Babel + Webpack + SASS
Stars: ✭ 144 (+60%)
Mutual labels: eslint, boilerplate, travis-ci
Express Boilerplate
🚀 Starter project for a RESTful API in Node with Express & mongoose component-based
Stars: ✭ 9 (-90%)
Mutual labels: eslint, boilerplate
Html Sass Babel Webpack Boilerplate
Webpack 4 + Babel + ES6 + SASS + HTML Modules + Livereload
Stars: ✭ 35 (-61.11%)
Mutual labels: eslint, boilerplate
Koa Rest Api Boilerplate
💯 Boilerplate for Node.js Koa RESTful API application with Docker, Swagger, Jest, CodeCov and CircleCI
Stars: ✭ 420 (+366.67%)
Mutual labels: swagger, boilerplate
Express Babel
Express starter kit with ES2017+ support, testing, linting, and code coverage
Stars: ✭ 621 (+590%)
Mutual labels: eslint, boilerplate
Express React Boilerplate
🚀🚀🚀 This is a tool that helps programmers create Express & React projects easily base on react-cool-starter.
Stars: ✭ 32 (-64.44%)
Mutual labels: eslint, boilerplate
Electron React Boilerplate
A Foundation for Scalable Cross-Platform Apps
Stars: ✭ 18,727 (+20707.78%)
Mutual labels: eslint, boilerplate
Rest Hapi
🚀 A RESTful API generator for Node.js
Stars: ✭ 1,102 (+1124.44%)
Mutual labels: swagger, hapi
Generator Dhboilerplate
Boilerplate made by David Hellmann
Stars: ✭ 54 (-40%)
Mutual labels: eslint, boilerplate
Nodejs Api Boilerplate
A boilerplate for kickstart your nodejs api project with JWT Auth and some new Techs :)
Stars: ✭ 364 (+304.44%)
Mutual labels: eslint, boilerplate
Pwa
An opinionated progressive web app boilerplate
Stars: ✭ 353 (+292.22%)
Mutual labels: eslint, boilerplate
React Isomorphic Boilerplate
🌟 An universal React isomorphic boilerplate for building server-side render web app.
Stars: ✭ 653 (+625.56%)
Mutual labels: eslint, boilerplate
Cpp Project
Boiler plate template for C++ projects, with CMake, Doctest, Travis CI, Appveyor, Github Actions and coverage reports.
Stars: ✭ 328 (+264.44%)
Mutual labels: boilerplate, travis-ci
Thinkful Workshop React Redux Node Mongodb Webpack2
Stars: ✭ 12 (-86.67%)
Mutual labels: eslint, boilerplate
Nest Hackathon Starter
Hackathon starter project for NestJS. Includes TypeORM, email verification, Passport-JWT authentication, Swagger and more
Stars: ✭ 86 (-4.44%)
Mutual labels: swagger, boilerplate
Flask Api Starter Kit
Start a Flask API in less than 5 minutes
Stars: ✭ 296 (+228.89%)
Mutual labels: swagger, boilerplate
React Bolt
⚡ The most simple & robust boilerplate for your React projects.
Stars: ✭ 298 (+231.11%)
Mutual labels: eslint, boilerplate
testing-hapi
Example Hapi-backed API Server with testing, CI, and Swagger documentation generator.
Updated and tested with latest hapi packages as of 1/16/2018.
How to run
Requires Node v8.12.0+
yarn install #install dependencies
yarn start # start server
yarn test # run tests
Details
-
Notable npms
-
hapi, joi
-
hapi
is a popular web/services nodejs framework. It is strict about routing and validation out of the box and has a mature plugin/extension system. I've usedexpress
for a long time, but since tryinghapi
, I haven't really looked back. On the surface the two frameworks look similar. In my experience though, I found thathapi
managed to scale much better with increasing complexity and made it easier to test, debug, and write better code. -
joi
is an awesome schema/object definition and validation library. This project uses it to enforce API input/output validation and generate documentation.
-
-
hapi-swagger
-
Swagger is an API framework and standard.
hapi-swagger
is a hapi plugin that generates awesome interactive API documentation & UI right from our code API definitions. I gotta say... it's really nice to keep everything in one place.
-
Swagger is an API framework and standard.
-
lab
-
lab
is hapi's version of mocha. It's a test runner, nicely packaged with a linter and code-coverage reporter. Nothing you wouldn't expect here. (Unless you've never written tests)
-
-
hapi, joi
-
Testing
- Unit Tests (
/test/unit/*
)- Functions containing business logic are defined in isolation from the framework making them testable without a running server
- Functional Tests (
test/functional/*
)- These tests are meant to target the API endpoints, covering functionality end-to-end.
- We should try to write these tests in a way that they become easily exportable to run automatically via tools like New Relic Synthetics
- ESLint
-
lab
also includes a linter (eslint by default), which is executed when tests run. The default configuration can be customized via the.eslintrc.json
file.
-
- Code Coverage
-
lab
analyzes the code and returns the code coverage ratio when running the test. It also points out which lines of code are missing coverage. A nice reminder to write tests for any newly added functionality.
-
- Unit Tests (
-
Documentation
-
hapi-swagger
is configured inapp.js
and generates a very nice html page with an interactive Swagger compatible API. - Once your server is running locally, visit http://localhost:3000 to check out the docs.
- My typical workflow is to write the documentation first (by setting up the hapi routing #2BirdsWith1Stone), then to write the functional tests, then a combination of code and unit tests ala TDD until I'm satisfied with the results.
-
-
CI
- This repo also integrates TravisCI, which runs the tests defined above on every pull request, blocking a merge if the test does not pass. Not very useful for a one person project, but crucial when a team of developers is involved.
TODO
- add stubbing framework to imitate external service calls.
- Figure out an easy way to test multiple hapi services together, in a microservice environment.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].