0.1.0 • Published 8 years ago
curlable v0.1.0
curlable
A simple wrapper to turn stateless command-line utilities into HTTP endpoints.
Example
TL;DR:
$ ./curlable.js -c 'bc -l'                                          # In one terminal.
$ curl -d '2 ^ 10' localhost:8000 && curl -x DELETE localhost:8000  # In another terminal.You should see:
$ ./curlable.js -c 'bc -l'
Making `bc -l` curlable at http://localhost:8000/
Spawned `/bin/bash` with `bc -l`, PID 12266
Service started.
UGKE-ECRX	-	2 ^ 10
UGKE-ECRX	1ms	1024
DELETE request received. Stopping the external service.
External service stopped.
Quitting the binary due to an extenal DELETE request.$ curl -d '2 ^ 10' localhost:8000 && curl -X DELETE localhost:8000
1024
Terminating.Usage
The supported command line parameters are:
- -c: The external command to- curl-ify.
- -p: The port to spawn the tool on, defaults to- 8000.
- -r: The route to listen on, defaults to- /.
Running the Tests
$ npm install
$ npm test  # or `make`