A basic GET/POST widgets API for testing
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Widget API
Basic NodeJS API that provides basic GET/POST REST API testing services for a fake widgets store.
Install nodeJS. Run npm install in app directory to install dependencies. To start run node server.js. Listens on port 3001 - changeable in server.js

Edit the routes/widgets.json file with entries for your widgets - note id is mandatory.

Example - READ
curl "http://widgets.example.com:3001/widget/3"
{ "result": [ { "id": "3", "name": "shortWidget", "height": "31", "width": "33", "length": "4" } ] }

Example - CREATE
curl -H "Content-Type: application/json" --request POST --data '{"id": "4", "name": "shortWidget","height": "31","width": "33", "length": "4"}' "http://widgets.example.com:3001/widget"
{ "result": [ "Widget Created" ] }

Note a wildcard GET on ../widget/queryAll returns all entries.