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

stackerjs

v1.1.34

Published

Stack for building Microservices

Downloads

23

Readme

Travis Test Coverage Maintainability Dependencies npm

NPM

StackerJS

A Stack built in NodeJS using ExpressJS, for building NodeJS microservices.

Table of Contents

  • Introduction
  • Configuration
  • Contributions
    • Testing

Installation

    npm install -g typescript istanbul
    npm install stackerjs --save

Configuration

Most of stackerjs configuration can be declared on .env file in project root.

Connection

For DB Connection until now only MySQL driver is implemented.

  • DB_DRIVER=stackerjs-db-mysql-adapter - Defines database driver
  • DB_HOST=127.0.0.1 - Defines database host
  • DB_NAME=database - Defines database name
  • DB_USER=root - Defines database user
  • DB_PASS=p455w0rd - Defines database access password

Slack Integration

For Slack integration, you must integrate you workspace with incoming-message App and add service hook to .env

  • SLACK_HOOK=https://hoook.slacker.com/service/ADSMDFIADNFSD/ADJIJAO - Defines Webhook url
  • SLACK_ICON=http://image-to-icon/you/want.png - Defines an icon to Slack messages (Default is StackerJS logo).
  • SLACK_CHANNEL=my-channel - Defines the channel where messages should be sent to (Default is "general").

PS.: When Slack configuration is setted, error 500 messages are sent to Slack Channel configured.

Http

StackerJS implements Http request and response classes based on ExpressJS.

Http.Request

Brings information about made request. Always received on callback action executed during request.

For example a request made to /person/:id.

    import { Http } from 'stackerjs';

    const viewAction = (request:Http.Request):string =>
        `Looking for ${request.get('id')} ?`;

Http.Response

Callbacks can return a string, an object or even Http.Response class defining response information.

    import { Http } from 'stackerjs';

    const viewAction = (request:Http.Request):Http.Response =>
        new Http.Response()
            .setStatusCode(404)
            .setHeader('Allow-anything', '1230')
            .setContent({
                'status': false,
                'message': [ 'Person not found or not existent' ]
            });

DB

Possible manipulate database using QueryBuilder and manually creating queries.

Connection

Database connection relies on database driver, so, if you wanna get a connection to database the right way is using Factory.

    import { DB } from 'stackerjs';

    let conn = DB.Factory.getConnection();

Query Builder

QueryBuilder depends on your database driver. So, if you want an instance of it, the right way is getting it by Factory.

    import { DB } from 'stackerjs';

    let conn = DB.Factory.getConnection();
    let queryBuilder = DB.Factory.getQueryBuilder();

    const getResults = async ():Array<any> =>
        await conn.query(
            queryBuilder.select()
                .set('id', 'name')
                .from('table_name')
                .order('name')
                .toSql()
        );

    getResults()
        .then(results => {
            //Manipulate list of database results
        });

Contributions

It's possible to contribute to StackerJS. Fork the project check for enhancements and bugs and make a Pull Request. If your PR receive 3 approves from Parpe team it will be accepted and merged.

Testing

    npm run build
    npm run test