Skip to content
README.md 889 B
Newer Older
# api-ttl-lifo-express
Work with stack and data with support TTL

# Technologies
Node.js, keeping data in stack type and with supporting of TTL

# Run server locally
Clone this repo.
* Define .env file in the root of project and variables (below default values which will run automatically):
    * PORT=3000
    * NODE_ENV=dev
    * TTL_EXPIRATION=30

### npm i
For installing packages

### npm run start:dev
Run server with live-reload

### npm start
Run server

### npm run test
Running tests

## Available endpoints
* Stack data
  * POST localhost:3000/stack - *add data to stack*
      * body { "data": any }
  * GET localhost:3000/stack - *get last item from stack and remove*
* TTL data
  * GET localhost:3000/ttl/:key - *get item by key*
  * POST localhost:3000/ttl - *add item*
      * body { "key": string; "value": any }
  * DELETE localhost:3000/ttl/:key - *remove item by key*