Installation
npm install rest-npm
Setup
rest-npm
takes two parameters. A port to run on, and an
object that defines what commands the API will accept as well as the number of arguments
each one requires.
var restNpm =// Configure with port and valid commandsrestNpmstart3000// view command accepts between 1 and 5 paramsview: 1 5// search command accepts 1 and only 1 paramsearch: 1;
Query Structure
The query structure is very simple. I wanted to mirror the npm cli interface as close as possible so the structure is very generic.
# Basic structure/<COMMAND>?p=<PARAM_1>&p=<PARAM_2>&p=<PARAM_3># Sample search query# npm search blog/search?p=blog# View module name, description and version# npm view express name description version/view?p=express&p=name&p=description&p=version
To-Do
- Write unit tests
- Better error handling