0.1.0-5 • Published 5 years ago

teleman-cache v0.1.0-5

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

teleman-cache

Teleman Server-Side Rendering middleware

Usage

import Teleman from 'teleman'
import cache from 'teleman-cache'

const api = new Teleman({
  urlPrefix: 'https://api.example.com'
})

api.use(cache({
  mode: CURRENT_ENV, // server | client
  variable: '__API_CACHE__',

  cacheKeyGenerator(ctx) {
    return ctx.url.pathname + ctx.url.search
  },

  tagGenerator(ctx) {
    return ctx.cacheTag
  },
  
  onServerCached() {
    window.PAGE_READY = true  
  },

  onClientConsumed() {
    mountAPPIntoDOM()
  }
}))
0.1.0-5

5 years ago

0.1.0-4

5 years ago

0.1.0-3

5 years ago

0.1.0-2

5 years ago

0.1.0-1

5 years ago