mirror of
https://github.com/cudr/slate-collaborative.git
synced 2024-10-27 20:34:06 +00:00
22 lines
513 B
JavaScript
22 lines
513 B
JavaScript
|
const Connection = require('@slate-collaborative/backend')
|
||
|
const defaultValue = require('./src/defaultValue')
|
||
|
|
||
|
const config = {
|
||
|
port: 9000,
|
||
|
defaultValue,
|
||
|
saveTreshold: 2000,
|
||
|
onAuthRequest: async (query, socket) => {
|
||
|
// some query validation
|
||
|
return true
|
||
|
},
|
||
|
onDocumentLoad: async pathname => {
|
||
|
// return initial document ValueJSON by pathnme
|
||
|
return defaultValue
|
||
|
},
|
||
|
onDocumentSave: async (pathname, document) => {
|
||
|
// save document
|
||
|
}
|
||
|
}
|
||
|
|
||
|
const connection = new Connection(config)
|