0.4.2 • Published 5 years ago

@roshub/express-xmlrpc v0.4.2

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

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.