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

pxl-dynamodb

v0.0.7

Published

Access counting for any Express-served url - e.g. for a tracking pixel in emails

Downloads

5

Readme

pxl-dynamodb

Access counting for any Express-served url - e.g. for a tracking pixel in emails

Overview

pxl-dynamodb is an extension of the pxl library that adds a persistence layer for DynamoDB based on pxl-mongodb.

Please check out the README of the pxl library and then come back for instructions on installing and using this library.

Installation

NPM Stats

This is a module for node.js and is installed via npm:

npm install pxl-dynamodb --save

pxl is installed automatically with pxl-dynamodb.

Usage

Everything described in the README of the pxl library is relevant for pxl-dynamodb as well. The only difference is that this library includes a persistence layer for DynamoDB and needs to be initialized differently.

NOTE: The Pxls and Links tables must be created on the DB beforehand.

let PxlDynamodb = require('pxl-dynamodb')

let pxl = new PxlDynamodb({

    // Options described for the pxl lib like queryParam and logPxlFailed can be passed here as well
    
    // Additional options are:
    collectionPxls: 'pxls', // Name of the DynamoDB table to store pxl documents for access tracking
    collectionLinks: 'links', // Name of the DynamoDB table to store shortened links
    
    alwaysShortenWithNewLinkId: false // Set to true if you need a different linkId each time you shorten a link - even if the link was shortened before
    
    // Omit the options to use the default values equal to the example values above
    
})

Before you use any functions like pxl.createdPxl(...) you need to connect to the database:

pxl.connect({
        region: 'localhost',
        endpoint: 'http://localhost:8000',
        accessKeyId: 'MOCK_ACCESS_KEY_ID',
        secretAccessKey: 'MOCK_SECRET_ACCESS_KEY'
    }) // Passed values are the defaults
  • First parameter uri: The DynamoDB connection string that is used to connect to the database using the dynamodb library
  • Second parameter connectionOptions: Additional options to configure the connection. For details see the dynamodb API docs.
  • Returns a promise with the collection objects as shown above. For details see the dynamodb API docs.

And finally:

pxl.disconnect()
    .then(() => {
        console.log('Database connection is closed')
    })

Contributing

To set up your development environment for pxl-dynamodb:

  1. Clone this repo to your desktop,
  2. in the shell cd to the main folder,
  3. hit npm install,
  4. hit npm install gulp -g if you haven't installed gulp globally yet, and
  5. run gulp dev. (Or run node ./node_modules/.bin/gulp dev if you don't want to install gulp globally.)

gulp dev watches all source files and if you save some changes it will lint the code and execute all tests. The test coverage report can be viewed from ./coverage/lcov-report/index.html.

If you want to debug a test you should use gulp test-without-coverage to run all tests without obscuring the code by the test coverage instrumentation.

Change History

  • v0.0.6 (2017-07-23)
    • Log createdAt and updatedAt
  • v0.0.5 (2017-06-07)
    • Readme updated
  • v0.0.4 (2017-06-07)
    • Initial version

License (MIT)

See the LICENSE file for details.