This is an API application that stores a key-value pair and retrieves the latest value stored in the system
Pre-requisites (install with -g option)
- Node >= 8.4.0
- NPM
- SWAGGER = 2.0
- [apiDoc][http://apidocjs.com/]
$ git clone https://github.com/dennisjade/key-value.git
$ cd key-value
$ npm install
$ npm start
$ npm test
- In the root directory, run the command below
- To view the HTML version report, go to coverage/lcov-report/index.html
$ ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha test/**/*
$ apidoc -i api -o doc/
$ swagger project edit
Method | Route | Params | Description |
---|---|---|---|
GET | /object/key | NONE | Retrieves latest value stored based on the key |
GET | /object/key | timestamp | Retrieves latest value stored based on key and within timestamp |
POST | /object | key;value | Add key-value pair in DB. Pass inside the body |
$ curl -X 'GET' http://localhost:10010/object/1
$ curl -X 'GET' http://localhost:10010/object/1?timestamp=1505231250937
$ curl -H "Content-Type: application/json" -X POST -d '{"animal":"cat"}' http://localhost:10010/object