Reading data from NodeJs Serialport
<p>I would like to be able to read data received by the ascii command sent.</p>

<p>Below is the code that sends command to my lock controller</p>

<pre><code>var express = require('express');
var router = express.Router();
var SerialPort = require('serialport');


/* GET home page */
router.get('/', function(request, response){


    SerialPort.list(function (err, ports) {
      ports.forEach(function(port) {
        console.log(port.comName);
        console.log(port.pnpId);
        console.log(port.manufacturer);
      });
    });


    var port = new SerialPort("COM5", {
  baudRate: 38400
});

    port.on('open', function() {
        // NodeJS v4 and earlier
        port.write(new Buffer('status1', 'ascii'), function(err) {
          if (err) {
            return console.log('Error on write: ', err.message);
          }
          console.log('message written');

        });
    });

    // open errors will be emitted as an error event 
    port.on('error', function(err) {
      console.log('Error: ', err.message);
    });

});

// Important
module.exports = router;
</code></pre>

<p>In the doc, it mentions the use of parsers to try and read data, <a href="https://github.com/EmergingTechnologyAdvisors/node-serialport#serialportparsers--object" rel="nofollow">https://github.com/EmergingTechnologyAdvisors/node-serialport#serialportparsers--object</a> but I am not sure how to implement it, and I would want to execute after the command <code>status1</code> has been written.</p>

<p>Essentially logs the response of the command succesfully written to the console</p>