realm / realm-object-server

Tracking of issues related to the Realm Object Server and other general issues not related to the specific SDK's
https://realm.io
293 stars 42 forks source link

Can't build ROS 2.0 when using middleware #304

Closed Damnum closed 6 years ago

Damnum commented 6 years ago

Goals

Build ROS via NPM using npm run-script build

My ./src/index.ts looks like this:

import * as cors from 'cors'
import { Server } from 'realm-object-server'
import * as path from 'path'

const server = new Server()
console.log("Server Ling", server)
server.useMiddleware(cors())
...

Expected Results

Build is successful.

Actual Results

Build throws error: error TS2339: Property 'useMiddleware' does not exist on type 'Server'

Steps to Reproduce

My setup follows the steps provided in the docs: https://realm.io/docs/realm-object-server/latest/#custom-middlewares

Why does Server.useMiddleware not exist?

Version of Realm and Tooling

mbalex99 commented 6 years ago

We made a minor API change about the useMiddlewares now it is a start param called middlewares

import { BasicServer } from 'realm-object-server'
import * as path from 'path'
import * as cors from 'cors'

const server = new BasicServer()

server.start({
        // This is the location where ROS will store its runtime data
        dataPath: path.join(__dirname, '../data')
        middlewares: [cors()]
    })
    .then(() => {
        console.log(`Realm Object Server was started on ${server.address}`)
    })
    .catch(err => {
        console.error(`Error starting Realm Object Server: ${err.message}`)
    })
Damnum commented 6 years ago

Ok thanks, that works now.

mbalex99 commented 6 years ago

Glad to have helped

TariqTawalbeh commented 5 years ago

can I get any synced data from the middleware and put it on anywhere I want ?