Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

..
Failed to load latest commit information.
views
.gitignore
README.md
app.js
package.json

README.md

To run this example:

First install all the dependencies

  npm install .

Next start the example:

  node app.js

Now visit http://localhost:3000/ in your browser

Next steps - Things to try doing with the example:

  1. Visit the documentation page and run all the examples

  2. Open the JavaScript console in your browser and use the API

  //Lets first create a user
  UserService.create({ name: "user", password:"password", email:"email@email.com" });
  //Now let's load that same user a few times
  UserService.load({id:0});  
  UserService.load({id:0});  
  UserService.load({id:0});  

If we look at the browsers network inspection tool you'll notice that HopJS has applied all the various HTTP caching headers to prevent the browser from requesting the object again.

Also if you look at the console log for the application you'll see the log message that HopJS has created regarding caching. You should notice that even though we requested the object multiple times we only see that the item was saved once.

# We can also use the redis-cli to pull up the cached copy of the item (within 60 seconds of it being cached)
redis-cli
# redis 127.0.0.1:6379> get /user/0
Something went wrong with that request. Please try again.