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

horpax

v0.8.0

Published

Framework on top of express node.js. Designed for rapid application development

Downloads

3

Readme

HORPAX

Build Status Downloads Downloads NPM version

Core concepts

Framework on top of express node.js. Designed for rapid application development. It allows easy create CRUDs (create, read, update and delete) for any custom resource. They can be created even in runtime. It is very flexible in changing default behavior of any operations, allowing customization or giving access to raw express.js requests and responses. It has lot of pre made useful features like authorization.

Horpax

Instance of this class starts new node server. This is root object of application composition. It manages Stores and Resources


deprecated

Attribute

It is single attribute of model. Each of those: name, surname, age, bornData are attributes.

Attribute options

  • modelName - map model db key to attribute
  • allowFilter - property can be a filter in request query
  • filterName - map query param to attribute
  • allowBody - property can be in request body
  • bodyName - name property in body

AttributeType

Each attribute has some type like string, number, object. In our example name and surname are string attributeType. But age is number attributeType and bornDate is date.

Schema

Collection of attributes is Schema.

Model

It is object allowing communication with database. It need schema.

Action

It is single endpoint. For example when we want save user we use action post endpoint.

Controller

It is consist with related actions. Like we have user controller.

Adapter

In model we have different values. We may want to save them to different databases or do something different. Each target for source should have onw adapter. Adapter is responsible for converting value to aimed target. For example we have age which has AttributeType number. But it is possible that target database doesn't have number type and we need DatabaseNumberAdapter which will convert number to string and string to number.

Get started

  1. Create instance then start it
    const horpax = new Horpax();
    await horpax.start();
  1. Implement functionality
  • You can add inline controllers, actions ...
    const idAttribute = new Attribute("_id", { });
    const nameAttribute = new Attribute("name", { });

    const schema = new Schema();
    schema.addAttribute(idAttribute);
    schema.addAttribute(nameAttribute);

    const model = new Model("resources", Model.getStoreManager().getDefaultStore());
    model.setSchema(schema);

    const createAction = new CreateAction("resourceCreateAction");
    createAction.setModel(model);

    const controller = new Controller("manageResources", "/resources");
    controller.addAction(createAction);
    horpax.getControllerManager().addController(controller);
  • Create different components and pass Horpax instance
   export default class Resources {
     constructor(horpax) {
       const idAttribute = new Attribute("_id", { });
       const nameAttribute = new Attribute("name", { });
   
       const schema = new Schema();
       schema.addAttribute(idAttribute);
       schema.addAttribute(nameAttribute);
   
       const model = new Model("resources", Model.getStoreManager().getDefaultStore());
       model.setSchema(schema);
   
       const createAction = new CreateAction("resourceCreateAction");
       createAction.setModel(model);
   
       const controller = new Controller("manageResources", "/resources");
       controller.addAction(createAction);
       horpax.getControllerManager().addController(controller);
     }
   }

Debugger

Each element has debug module. For getting all debug info

DEBUG=horpax:* <command to run>

For specific debug, for example controller:

DEBUG=horpax:controller:* <command to run>

For specific controller

DEBUG=horpax:controller:<controller name> <command to run>