How to use the jayson/promise.server function in jayson

To help you get started, we’ve selected a few jayson examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github beakerbrowser / beaker / app / background-process / bkr.js View on Github external
})
  }

  methods.exportFileFromArchive = ([srcKey, srcPath, dstPath]) => {
    var srcArchive = datLibrary.getArchive(srcKey)
    return pda.exportArchiveToFilesystem({
      srcArchive,
      srcPath,
      dstPath,
      overwriteExisting: true,
      skipUndownloadedFiles: true
    })
  }

  // start the server
  server = jayson.server(methods).tcp()
  server.listen(BKR_SERVER_PORT, 'localhost', err => {
    if (err) console.error('Failed to create brk server', err)
    debug('bkr server running on port %d', BKR_SERVER_PORT)
  })
}
github y12studio / dltdojo / index.js View on Github external
function startServer(argv) {
    // jayson.server(rpcMethods).http().listen(RPCPORT);
    var jsonParser = require('body-parser').json;
    var jserver = jayson.server(rpcMethods)
    var express = require('express')
    var serveStatic = require('serve-static')
    var app = express()
    app.use(serveStatic('docs/', {
        'index': ['index.html']
    }))
    app.use(jsonParser())
    app.use(jserver.middleware())
    showServerMsg(argv.pubhost||'host_ip')
    app.listen(RPCPORT)
}