-
Notifications
You must be signed in to change notification settings - Fork 0
Hapi
Wheater edited this page Sep 23, 2015
·
2 revisions
Hapi is a NodeJS middelware extension.
Hapi: HapiJS.com Github: https://github.com/hapijs/hapi Github-wiki: https://github.com/hapijs/hapi/wiki
In the current iteration, Hapi is used for as a REST API middleware on the NodeJS instance. We are listening on port 8000 accepting rest API calls from the front-end (Ember).
Testing the server instance in Hapi accomplished via Lab and Code npm packages. Hapi has a server.inject API for simulating HTTP calls to the REST API. By mocking those calls, we test the results of the rest of the server response. Testing is done with a real instance of MongoDB for simplicity, as mocking the database brings many challenges of its own.
Authentication in Hapi is described here: http://hapijs.com/tutorials/auth