add backend code to the collab demo

This commit is contained in:
Hans Pagel 2020-11-30 14:20:31 +01:00
parent f1f974b13a
commit b42b39a4c5

View File

@ -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.
:::
<!-- <demo name="Examples/CollaborativeEditing" :show-source="false"/> -->
<demo name="Examples/CollaborativeEditing" />
In case youre 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()
```