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

us-states-ref

v1.1.0

Published

Service, convenience Express endpoints for getting misc data on US states, e.g. addresses, license formats, etc.

Downloads

6

Readme

us-states-ref

Quick reference of info related to U.S. states, e.g. sample addresses, driver's license formats, etc.

Exposes service for use in code, Express router for convenient GET endpoints, e.g. to hit with your testing scripts/other personal work.

Pre-req's

Node 4.6.0

Setup

  1. Copy or clone project to computer.

  2. Install the dependencies listed in package.json, e.g. in the command prompt, nav to the us-states-ref folder and npm install

  3. After that's done, stay in the same folder and run npm test. If the tests pass, you're all set!

  4. See the apiController for mountable endpoints on an Express app.

Example usage

Using the service in code

var StateService = require('../services/StateService');
var stateService = new StateService();
console.log(stateService.getAllStates());

Mounting endpoints to an existing Express app

var express = require('express');
var apiController = require('us-states-ref').usStatesExpressRouter;

// app.use(rootPath, expressRouter)
app.use('/usstates', apiController)

Test with a GET request to /usstates/api/v1/states

Endpoint client

See an example at us-states-ref-client.

Notes for users

Drivers license format source - the Internet... your mileage may vary.

Wishlist

  1. Sample addresses for all states, which will pass the remaining failing jasmine specs.

  2. Extra endpoints for finer grained data - see apiController for ideas.

  3. Get random sample addresses from an external source?

Project 20/20

  1. The Express router makes it trivial to add endpoints onto an existing Express app. Some similarity to EARs/WARs on a Java web server.

  2. Jasmine is easy to pick up, many concepts also transferable from JUnit/Spock. Simple enough to set up test cases running through data-driven scenarios.

  3. Publishing packages to npm and using them in different projects (via inclusion in a package.json) is a smooth process. These service + Express router packages might be handy for a Node/Express microservices server. Time'll tell...

  4. Node's require can read in a json file and transform for js objects. Painless but be aware - it's a synchronous/blocking operation.