reserve-cmd

command handler for REserve


Keywords
reserve, command, cmd, reserve-handler
License
MIT
Install
npm install reserve-cmd@1.0.4

Documentation

REserve/cmd

Command line handler for REserve. It allows execution and output capturing of command lines.

Travis-CI Coverage Status Maintainability Package Quality Known Vulnerabilities dependencies Status devDependencies Status reserve reserve install size MIT License

Usage

{
  "handlers": {
    "cmd": "reserve-cmd"
  },
  "mappings": [{
    "match": "\\/test",
    "cmd": "./test.cmd"
  }]
}

Capturing group values substitutions can be used, space escaping is done with the character `.

Options

Option Default Value Explanation
env {} Additional variables to be used in the created process (see child_process.execFile)
html-footer '' Additional content to be added in the footer of the HTML output
html-header '' Additional content to be added in the header of the HTML output
html-tracking false Injects JavaScript code to scroll the HTML output while executing
text-only false When set, the output is always text
timeout 0 Automatic kill of the process (see child_process.execFile)

Any command can be executed (use it carefully). If a process can not be started, the request ends with a 500 error.

Supported verbs

GET

The handler adapts the output based on the accepted mime-type. If text/html is found in the accept header, the content is formatted to HTML. Otherwise, the output uses text format.