Initial standalone server implementation (#15)

Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
Andrey Platov
2021-08-08 23:04:39 +02:00
committed by GitHub
parent 67940e0d35
commit a8693be822
41 changed files with 349 additions and 174 deletions
+4 -1
View File
@@ -23,6 +23,9 @@
"@anticrm/dev-storage": "~0.6.3",
"@anticrm/server-ws": "~0.6.4",
"@anticrm/core": "~0.6.7",
"@anticrm/platform": "~0.6.5"
"@anticrm/platform": "~0.6.5",
"jwt-simple": "~0.5.6",
"@anticrm/server-chunter": "~0.6.0",
"@anticrm/dev-server-chunter-resources": "~0.6.3"
}
}
+5
View File
@@ -16,5 +16,10 @@
import { start } from '.'
import { encode } from 'jwt-simple'
const token = encode({ email: 'rosamund@hc.engineering', workspace: 'ws1' }, 'secret')
console.log(token)
// eslint-disable-next-line @typescript-eslint/no-floating-promises
start(3333)
+5
View File
@@ -18,10 +18,15 @@ import { start as startJsonRpc } from '@anticrm/server-ws'
import { createStorage } from '@anticrm/dev-storage'
import { DevSession } from './session'
import { addLocation } from '@anticrm/platform'
import { serverChunterId } from '@anticrm/server-chunter'
/**
* @public
*/
export async function start (port: number, host?: string): Promise<void> {
addLocation(serverChunterId, () => import('@anticrm/dev-server-chunter-resources'))
const storage = await createStorage()
startJsonRpc(server => new DevSession(server, storage), port, host)
}
+1
View File
@@ -30,6 +30,7 @@ export class DevSession implements Storage {
async tx (tx: Tx): Promise<void> {
const derived = await this.storage.tx(tx)
this.server.broadcast(this, { result: tx })
for (const tx of derived) {
this.server.broadcast(this, { result: tx })
}