Giter VIP home page Giter VIP logo

cache-api's Introduction

cache-api

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/)

Requirements

  • MongoDB instance
  • Node ~14 and above

API installation and setup

  1. Create a .env file in the root directory. ..env-sample file is provided for you at the root of the project:

  2. yarn install Install Dependencies

  3. yarn build Build the API

  4. yarn start:dev start the API in development mode

  5. yarn start:prod start the API in production mode

Postman collection

Run in Postman

Supported routes

  • 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

Note

  • 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) πŸ˜πŸ˜πŸ•ΊπŸΌπŸ•ΊπŸΌ

cache-api's People

Contributors

geezercodes avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.