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

http-store

v0.6.1

Published

Generic DataStore Using HTTP Verbs

Downloads

8

Readme

#HTTP Store

HTTP Key-Value Store on top of MongoDB

##Features

  • Connect to a MongoDB Instance using HTTP and Web Sockets
  • Already Compatible with zillions of applications and devices that already speak these standards
  • Send data between http and websocket clients

##Other Docs:

##Prerequesites Befor you deploy anywhere, you must have a mongodb server instance running somewhere. Mongo Lab provides this as a service for free.

##Installation

###Remote

####Deploy on Heroku

  1. Click Here:

Deploy

  1. Use Mongo DB credentials to fill out form and follow instructions.

The Procfile includes the verbose (-v) command line argument, so if deploying straight to heroku frome this repository and you have the heroku toolbelt, you may access the application's output via

heroku logs --tail

If you wish to disable this, you may modify the program (see below) and push directly to heroku.

###Locally

####Pre Requesites Node and npm are required to run this locally. Installing node will automatically install npm. Git is also necessary.

####Command Line Application x

  • Download and install the CLI app via npm:
npm install -g http-store
  • Run with command line arguments
http-store --db-url=mongodb://username:[email protected]:27017/database
  • Or run with enviromnem variables
export DB_URL=mongodb://username:[email protected]:27017/database && http-store

####Install via git and npm

  1. In a terminal type:
git clone git clone https://github.com/johnhenry/http-store.git
cd http-store
npm install

#####Running via npm

  1. In a terminal type:
npm start

By default, the server will run at 127.0.0.1:8080

Options will be set via environmental variables.

#####Running via node

  1. In a terminal type:
node server

OR

node server.js

By default, the server will run at 127.0.0.1:8080

Options can be set via command line arguments and/or environmental variables.

#####Running via foreman

If you have the heroku toolbelt installed, you can take advantage of foreman to run your app locally.

  1. In a terminal type:
foreman start

By default, the server will run at 127.0.0.1:5000

Options will be set via an optional .env file located in the root directory. Command line parameters may be set by modifying the Procfile file.

###Node package

Http store can also be mounted as a router in other node (express) applications.

####Import store object

Supply options to create http-store object object. Note: database options must be supplied when creating object. Other options are, well... optional.

var options = {
    //...db options required
}
var store = require('http-store')(options);

####Mount to express application server

Mount at express point just like any other router

< express app >.use(mountPoint, store);

####Mount store object to server Mount the sockets to the server by calling the < store instance >.mountSocket method. Note: can be attached to any http server, not just an express instance.

var server = < http or express app server >;
store.mountSocket(server, [mount point = "/"]);

####Full example

var httpPort = 8080;
var app = require('express')();
var store = require('http-store')(
    {
        DB_URL : "mongodb://username:[email protected]:27017/database"
    }
);
app.use("/mount/point", store);//Mount database
store.mountSocket(
    app.listen(httpPort),
    "mount/point");//MountSocket

#####Connect

curl -x PUT <server location>/mount/point/:KEY Hello
curl -x GET <server location>/mount/point/:KEY
wscat -c <server location>/mount/point/:KEY