A small example of microservices architecture using hapi and chairo.
For more information about micro-service and api-gateway architecture Micro-services - API gateway
In order to running the architecture it is necessary to install all the dependecies and to run the gulp default task which starts the micro-services and the api-gateway.
hapi-chairo.ms/
README.md
node_modules/
package.json
plugins/
services/
spec/
gulpfile.js
server.js
git clone 'https://github.com/antomor/hapi-chairo-ms.git'
We need to run the npm instal
command from the directory in which the repo has been cloned
cd hapi-chairo-ms
npm install
In order to run the default gulp task:
gulp
The gulp.js
file contains also other tasks:
run:<name-service>
to start a single micro-servicerun:services
to start all the micro-servicerun:server
to start the api-gateway servicerun:all
to start the api-gateway service and all the micro-services
For running the tests, please make to sure to have started the application with gulp
.
npm test
All the tests are in the spec
folder.
Each micro-service is provided with a *-spec file containing the test for that specific service.
- Gulp - Task Runner
- hapi - Web services framework
- chairo - Senece micro-services plugin
- Jasmin - For writing BDD micro-services tests
- Thank you to PianoBit which permitted me to practice with the tools and architecture described.