Reset pouch for GPII development config
cli at ocadu.ca
Mon Aug 29 20:56:31 UTC 2016
As we discussed in today’s pouch meeting, I’m adding a http request handler for resetting pouch to its initial state when GPII runs in the development mode and the pouch DB is used as the data storage for the authorization server.
My thought is to add a request handler of /reset-pouch at the component level of “pouchHarness.express”. Speaking in code, this component sits at https://github.com/the-t-in-rtf/gpii-pouchdb/blob/GPII-1897/src/js/harness.js#L31
So, i’m learning gpii-express to understand how to add a request handler with it. My experiment so far, which is not very successful: https://github.com/cindyli/universal/blob/GPII-1821/gpii/node_modules/pouchManager/src/pouchManager.js#L62
This resetHandler component is distributed to “pouchHarness.express” at line 55.
The issue is the actual reset handler at line 85 is not hooked up.
Could you shed a light on how to connect “gpii.express.router” and “gpii.express.handler”? Let me know if I’m using wrong components at all. Thanks.
The other thing I’d like to discuss is that, in the meeting we were talking about adding a createOnEvent on the pouchHarness and fire that event at the reset to trigger it to recreate. I wonder if we could do it by directly calling initDBs() once the clean up is finished since initDb() and cleanUp() are from the same component (gpii.pouch.express) API, less destructive and hopefully not less cleaner. :)
More information about the fluid-work