npm install
To quickly update on modified source files, Nodemon and TSNode is used to acomplish that.
npm start
Jest
package is used for testing
# Run all tests once
npm test
# Develop tests in watch mode
npm run test:dev
#build docker image
docker build -t [account]/[name] .
#run docker image
docker run [account]/[name]
An endpoint to add an item to the stack
Request:
- method:
POST
- endpoint:
/api/stack
Body:
item
- the item field is required
Example:
curl --location --request POST 'localhost:3000/api/stack' \
--header 'Content-Type: application/json' \
--data-raw '{
"item": "hello"
}'
An endpoint to return the top item of the stack.
Request:
- method:
GET
- endpoint:
/api/stack
Example:
curl --location --request GET 'localhost:3000/api/stack'
An endpoint to add a key-value to the store
Request:
- method:
POST
- endpoint:
/api/store
Body:
key
- the key field is required and have to be stringvalue
- the value field is requiredttl
- the ttl field is optional should beinteger
and representms
Example:
curl --location --request POST 'localhost:3000/api/store' \
--header 'Content-Type: application/json' \
--data-raw '{
"key": "name",
"value": "John",
"ttl": 30000
}'
An endpoint to get a value from the store based on key
Request:
- method:
GET
- endpoint:
/api/store/:key
Params:
key
Example:
curl --location --request GET 'localhost:3000/api/store/name'
An endpoint to delete a value for a given key
Request:
- method:
DELETE
- endpoint:
/api/store/:key
Params:
key
Example:
curl --location --request DELETE 'localhost:3000/api/store/name'