+
Skip to content

beaukuhn/cacheAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cacheAPI

Structure

app models randomObject.js package.json README.md server.js

Getting Started

  • Install the all the required modules listed in package.json with the terminal command ‘npm install’.
  • Within server.js, at the top under Base Setup, there exists configurable fields that can be redefined for your own local setup, i.e., you can change the URI values to match those of your local setup.

Database Schema

RandomObject [Model]

  • name::string
  • createdAt::DateExpiration:5mins

API Endpoints

/api/randomObjects

  • GET: Returns list of all objects in cache
  • POST: Create an object in the cache (Note: When cache is full, oldest created -- can also be oldest to be last modified -- object is deleted). I decided this since there was no specification for a batch create endpoint.
  • DELETE: Flushes the cache

/api/randomObjects/:randomObject_id

  • GET: Returns specified object
  • PUT: Update specified object
  • DELETE: Deletes specified object

Things I would improve

I would improve the modularity of the endpoints such that they are more descriptive. For example, perhaps creating an object would be done so using a POST to an endpoint /api/randomObjects/create/, etc, while also modularizing the server.js to be more readable. I would also include unit tests using a proper framework.

About

API for the cache

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载