mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-06 17:57:42 +02:00
Initial standalone server implementation (#15)
Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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 })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user