roccomuso / node-webhooks

:arrow_right_hook: Node.js module to create and trigger your own webHooks.
190 stars 47 forks source link

Add support for in-memory database (plain object) #16

Closed eloquence closed 6 years ago

eloquence commented 6 years ago

The on-disk database may not be desirable for many use cases. A plain object that can be persisted outside of this module seems like a good fallback. To allow seamless change from one to the other, the interfaces are identical, i.e. promises are used even when they are not strictly necessary.

This commit also adds tests, reusing several existing functions to verify that the in-memory database operates as expected.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+6.5%) to 91.617% when pulling a14d8a928c0bf0bbb0f5fd67b6deda1b548a9f5e on eloquence:inmemorydb into 5d19f1a653977a9018feb5a01960b110e3dd3b01 on roccomuso:master.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+6.5%) to 91.617% when pulling a14d8a928c0bf0bbb0f5fd67b6deda1b548a9f5e on eloquence:inmemorydb into 5d19f1a653977a9018feb5a01960b110e3dd3b01 on roccomuso:master.

eloquence commented 6 years ago

Looks like the build failure is due to the Travis setup still testing some really old Node versions which fail on some modules. I'd recommend removing those; requiring Node 4 as a minimum (8.9.0 is LTS now) seems pretty reasonable.

roccomuso commented 6 years ago

Sounds reasonable. Thanks for the PR. I'm gonna merge it right now, but the idea for the storage is to have a general interface. So we can build several storage connectors (Redis, MongoDB, lokiJS etc.) like express-session does..