@roshub/express-xmlrpc

0.4.2 • Public • Published

express-xmlrpc

xml-rpc server middleware for express built on node

'use strict'

const xmlrpc = require('express-xmlrpc')
const express = require('express')
const app = express()

const port = process.env.PORT || 9999

app.use(xmlrpc.bodyParser)

app.post('/', xmlrpc.apiHandler({
  echo: function (req, res) {
    xmlrpc.sendResult(req.body.params[0], req, res)
  }}
))

app.listen(port)

const client = xmlrpc.createClient({ port: port })
client.methodCall('echo', [{ data: 9001 }], (error, value) => {
  console.log(`error: '${error}'`)
  console.log(`value: '${JSON.stringify(value)}'`)
})

Installation

$ yarn add express-xmlrpc

Running Tests

make sure the dev dependencies are installed

$ yarn install

run the test

$ yarn test

Credits

Originally forked from the xrpc project. Uses Serializer and Deserializer logic from the rosnodejs package.

Package Sidebar

Install

npm i @roshub/express-xmlrpc

Weekly Downloads

1

Version

0.4.2

License

MIT

Unpacked Size

64.3 kB

Total Files

16

Last publish

Collaborators

  • nickzat
  • alanm