This Project has been implemented with the singleton design Pattern
in mind.
You can read more about design patterns here: (https://blog.logrocket.com/design-patterns-in-typescript-and-node-js/)
- MongoDB instance
- Node ~14 and above
-
Create a
.env
file in the root directory. ..env-sample
file is provided for you at the root of the project: -
yarn install
Install Dependencies -
yarn build
Build the API -
yarn start:dev
start the API in development mode -
yarn start:prod
start the API in production mode
-
GET
api/cache/:id- Retrieves the desired cache entry or creates a new one if not present
-
GET
api/cache- Retrieves all entries in the cache
-
POST
api/cache/:id |{ value: 'New Value' }
- Replaces the value of a given entry
-
DELETE
api/cache/:id- Deletes a given entry from the cache
-
DELETE
api/cache- Deletes all entries in the cache
To run the test suitcase:
> yarn test
- Jest gets a timeout when connecting to the local driver. As such sometimes the tests might fail to run.
- You can increase the timeout as suggested by Jest ie:
jest.settimeout(value)
πππΊπΌπΊπΌ