npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

shariff-backend-node

v3.0.0

Published

Shariff is used to determine how often a page is shared in social media, but without generating requests from the displaying page to the social sites.

Downloads

26

Readme

Shariff Node Backend

Shariff is used to determine how often a page is shared in social media, but without generating requests from the displaying page to the social sites.

Shariff Logo © 2014 Heise Zeitschriften Verlag

This document describes the Node backend. The following backends are also available:

The frontend is available here:

Installing the Shariff backend on you own server

Option 1: Run the standalone server

Create a project folder and install the Shariff server using npm:

$ mkdir my-shariff-server
$ cd my-shariff-server
$ npm init
$ npm install --save shariff-backend-node

The node package contains a configuration file shariff.json. The following configuration options are available:

| Key | Type | Description | |-------------|------|-------------| | port | integer | Port Shariff runs on | | host | string | Host/IP address Shariff runs on | | cache | object | Cache settings described below |

Cache settings:

| Key | Type | Description | |-------------|------|-------------| | engine | string | catbox backend | | expiresIn | integer | Cache duration in milliseconds |

Start Shariff with:

$ node node_modules/shariff-backend-node/run.js
141104/143603.929, info, Server ist running at: http://localhost:3001

Option 2:

Alternatively, you may call the Shariff backend from your own code. If called directly, the code will still use a cache and honor the expiresIn setting, the engine will however not be used in this case, just a simple object store.

Sample:

var Shariff = require('shariff-backend-node');

Shariff.getCounts('google.com').then(function(counts) {
    console.log('Success, counts:', counts);
}, function(err) {
    console.log('Failed to grab counts!', err);
});

If passed true as second parameter, the getCounts() method will not use its cache and instead re-query the services.

Testing your installation

Visit http://localhost:3001/?url=www.example.com to get a JSON structure containing the share counts:

{"facebook":1452,"googleplus":23}