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

sto

v1.0.37

Published

Simplest possible RESTFUL storage API

Downloads

76

Readme

sto

Generic fully RESTful CRUD API for quickly saving and fetching data objects. JSON-API Compliant. Mongo integrated. Node-cache for cache. Express and express-ws. Ideal for quick, simple, seemless saving and fetching.

The purpose of sto is to create a generalized API that can seemlessly log and return JSON data objects. Whether you want somewhere to store and retreive the state of your Javascript app, the data of your IoT device, or the user status of your mobile game, sto provides you with an easy to setup solution. Basically if you don't want to build a custom database integration or set up a server+API yourself, and your use case is tremendously simple, or if you are limited from direct database interaction by architectural or network security constraints, just set up sto and go.

How to Install

npm install -g sto
sto setup

Note: sto setup will build a config.json file which you can edit directly. More details on what you can do with it are provided in example.config.json in this repo. To run

sto 

(NOTE: logs will still be populated in the ./logs/ directory for warnings and errors. In future versions this will be adjustable in the config.)

How to Use:

Make HTTP requests to the following paths. For a more detailed implementation, check out test.js.

Insert data

POST
body: {collection: [collection], owner: [owner], data: [JSON-data-content]}
http(s)://[your-server-here]/v1/insert
returns a hash + id

Update data

PUT
body: {collection: [collection], id: [id], data: [JSON-data-content]}
http(s)://[your-server-here]/v1/update
returns a hash + id

Fetch by id

GET
http(s)://[your-server-here]/v1/[collection]/id/[id]

Fetch last input

GET
http(s)://[your-server-here]/v1/[collection]/last/[owner]

Fetch last 5 inputs

GET
http(s)://[your-server-here]/v1/[collection]/last/[owner]/5

Fetch page 2 of inputs split by 5 (newest first)

GET
http(s)://[your-server-here]/v1/[collection]/last/[owner]/5/page/1
# 0 indexed pages

Fetch first 5 inputs

GET
http(s)://[your-server-here]/v1/[collection]/first/[owner]/5

Fetch page 2 of inputs split by 5 (oldest first)

GET
http(s)://[your-server-here]/v1/[collection]/first/[owner]/5/page/1
# 0 indexed pages

Fetch by hash (unique to data)

GET
http(s)://[your-server-here]/v1/[collection]/hash/[hash]

Get a total count of data objects stored for a collection/owner

GET
http(s)://[your-server-here]/v1/[collection]/count/[owner]
#owner is optional 

Delete by id

DELETE
body: { collection: [collection], id: [id] } 
http(s)://[your-server-here]/v1/delete

Delete by hash (with owner-specific option)

DELETE
body: { collection: [collection], hashData: [hash], owner: [owner] } 
http(s)://[your-server-here]/v1/delete

Delete all documents by owner (with skip last n inserts option)

DELETE
body: { collection: [collection], owner: [owner-here], skip: [n] } 
http(s)://[your-server-here]/v1/delete
#including a skip value will preserver the last n inserts for specified owner

(NOTE: Collection specifications are always optional in these requests. If you do not include a collection, the default will be read from the config file.)

Things to do (please help!):

Write more docs Write more tests Integrations Build more standardized clients+wrappers

Wrappers

  • [x] Python
  • [ ] Node
  • [ ] Lua
  • [ ] Ruby
  • [ ] Java
  • [ ] C++
  • etc.

Key Feature Priorities

  • Managed API Keys in storage
  • Improved build process
  • Typescript port
  • Interface class for
    • handleCache -> Redis
    • handleDB -> sequelize (postgres + mysql), aurora, dynamo
  • Adding an /upload path for encoded/form-data

Planned Integrations

  • AWS Lambda / Zapier callbacks
  • DataLoader for batched requests
  • Sequelize or PostLoader for relational dbs (PostGres, MySQl, etc.)
  • Mosca for MQTT
  • Docker File
  • Travis CI / Automated Build Checks

License

[MIT]

Copyright 2017 z3dtech

If you take my code and modify it without giving me credit, I will hunt you down, read through your code, adopt changes I like, and thank you for your efforts. You've been warned.