From b42b39a4c5e4fb9e313d00fa2aff81205aa451ec Mon Sep 17 00:00:00 2001 From: Hans Pagel Date: Mon, 30 Nov 2020 14:20:31 +0100 Subject: [PATCH] add backend code to the collab demo --- .../examples/collaborative-editing.md | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/docs/src/docPages/examples/collaborative-editing.md b/docs/src/docPages/examples/collaborative-editing.md index 3ddfe3f0..cf112708 100644 --- a/docs/src/docPages/examples/collaborative-editing.md +++ b/docs/src/docPages/examples/collaborative-editing.md @@ -8,6 +8,21 @@ It connects all clients to a WebSocket server and merges changes to the document Be nice! The content of this editor is shared with other users from the Internet. ::: - - + +In case you’re wondering what kind of sorcery you need on the server to achieve this, here is the backend code for the demo: + +```js +import { Server } from '@hocuspocus/server' +import { LevelDB } from '@hocuspocus/leveldb' + +const server = Server.configure({ + port: 1234, + + persistence: new LevelDB({ + path: './database', + }), +}) + +server.listen() +```