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

serverbone

v0.8.5

Published

Serverside additions to backbone to serve collections and models as express apps

Downloads

15

Readme

Serverbone TravisCI Coverage Status

Introduction

Serverbone.js is a server-side Rest API framework that supports multiple data stores on Node.js. Especially, you can combine multiple data stores such as a document store (e.g. MongoDB using backbone-db-mongodb), and a key-value store for indexes (e.g. Redis using backbone-db-redis). The project is based on the following modules:

The goals of the framework are:

  • Define models using JSON configuration (based on JSON Schema, implemented by backbone-blueprint)
  • Mount models & collections CRUD easily into HTTP verbs by using Resource. E.g. HTTP POST should call Model.create.
  • Provide basis for implementing resource level fine grained ACL

Examples

Components

Models

BaseModel

BaseModel extends backbone-blueprint's ValidatingModel providing e.g. Model lifecycle conventions, ACL related functionality & CRUD helpers.

FlatModel

Model for storing strings/numbers. Meant to be used together with ValueIndexMixin.

JSONModel

Model for storing raw JSON data in the id field. Meant to be used together /w JSONIndexMixin.

Collections

BaseCollection

Base Collection for most other Collections

IndexCollection

Deprecated

IndexMixin

Mixin for creating collections, that can have their indexes stored in other databases from the main db of the Collection.

JSONIndexMixin

Mixin for Collections that store JSON data in model's id field.

MultiIndexMixin

Mixin for reading values from multiple indexes, i.e. joins multiple Redis sets.

ValueIndexMixin

Mixin for Collections that store plain strings into Redis sets.

ACL

ACL permissions are defined in the Model's schema as role: [actions]. Permissions may be defined in Model level (which applies to all properties) or per property (which overrides Model level permissions). For example:

permissions: {
	admin: ['*'],
	owner: ['update', 'destroy'],
	'*': ['read', 'create']
}

This would give admin role permission to all verbs. owner can update & destroy Model. Finally world (indicated by *) can read models & create new Model instances. How roles are defined is up to the application to implement. You should override Model's getRoles for implementing custom functionality.

Resource

Provides mapping Model/Collection CRUD operation into HTTP verbs, thus adding routes into express application. By default the following routes are added:

GET /

Maps to Collection.fetch.

POST /

Maps to Collection.post (creates a new model).

GET /:id

Maps to Model.fetch (fetches model with given id).

PUT /:id

Maps to Model.update (updates model with given id).

DELETE /:id

Maps to Model.delete (delete model with given id).

Utils

async

Helpers for running async functions.

response_utils

Handles sending JSON/error responses.

How to develop

Testing

make test

View code coverage reports

make check-coverage
open coverage/lcov-report/index.html