ft-next-affinity-client

1.0.0 • Public • Published

Next-Affinity-Client

This client provides client-side and server-side interfaces for calling the Affinity API

Usage

Server-side

npm install ft-next-affinity-client

Example call

const affinityApi = require('ft-next-affinity-client');
 
affinityApi.popular()
    .then(data => {
        // data of most popular items
    });

Articles information should not be called on the server-side on pages that are supposed to cache

Client-side

bower install next-affinity-client

const affinityClient = require('next-affinity-client');
 
affinityClient.popular({count: 5})
    .then(data => {
        // data for top 5 most popular items
    });
 
affinityClient.article({id: articleId})
    .then(data => {
        //affinity data for this article
    });
 
affinityClient.article({id: articleId, uid: userId})
    .then(data => {
        //affinity data for this article, removing user's already read items
    });

Readme

Keywords

none

Package Sidebar

Install

npm i ft-next-affinity-client

Weekly Downloads

1

Version

1.0.0

License

none

Last publish

Collaborators

  • robertboulton
  • seraph2000
  • hamza.samih
  • notlee
  • emmalewis
  • aendra
  • the-ft
  • rowanmanning
  • chee
  • alexwilson