From fb3d81bfca6a50254ff6ea1e3ec30e7967da112e Mon Sep 17 00:00:00 2001 From: Joe Fleming Date: Thu, 4 Jan 2018 20:28:40 -0700 Subject: [PATCH] chore: use persistence setting on server avoid the whole db.wire part... --- src/index.mjs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/index.mjs b/src/index.mjs index 5de4f7d..9d32c30 100644 --- a/src/index.mjs +++ b/src/index.mjs @@ -1,21 +1,17 @@ import mosca from 'mosca'; // source: https://github.com/mcollina/mosca/wiki/Mosca-basic-usage -// source: https://github.com/mcollina/mosca/wiki/Persistence-support const moscaSettings = { port: 1883, + persistence: { + factory: mosca.persistence.LevelUp, + path: 'db', + }, }; const server = new mosca.Server(moscaSettings); -// set up the persistence layer -const db = new mosca.persistence.LevelUp({ - path: 'db', -}); - -db.wire(server); - const setup = () => { console.log('Mosca server is up and running');