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 🙏

© 2025 – Pkg Stats / Ryan Hefner

icore

v0.1.38

Published

High-level framework for creating strict web applications

Downloads

11

Readme

Iсore

License Build Status Coverage Status Known Vulnerabilities

Icore is a framework a high-level to build strict web application. Allows the developer to focus on the final handler.

Features

This module for Node.js® implemented by following the ECMAScript® 2018 Language Specification Standard

  • strict interface
  • not immutable context
  • routing implements a binary tree
  • all asynchronous functions on promises
  • error handling

Install

To use iсore in your project, run:

npm i icore

Table of Contents

class Application

class Route

class Inquiry

class Application

constructor: new Application(options)

  • options <Object>

    • host <String> To start the development server using a different default hostname or IP address. This will start a TCP server listening for connections on the provided host. Default: 'localhost'.

    • port <Number> TCP port of remote server. Is required parameter.

    • timeout <Number> The number of milliseconds of inactivity before a socket is presumed to have timed out. A value of 0 will disable the timeout behavior on incoming connections. Default: 12e4 (2 minutes).

    • maxHeadersCount <Number> Limits maximum incoming headers count. If set to 0, no limit will be applied. Default: 2e3.

For example:

const icore = require('icore');

const app = new icore.Application({
  port: 3000
});

app.listenHttp(router)

  • router <Router> Is instance class Route this module.
  • returns: <Promise> Following successful listen, the Promise is resolved with an value with a undefined.

Starts the HTTP server listening for connections. These arguments are documented on nodejs.org.

index.js

const icore = require('icore');
const router = require('./router');

const app = new icore.Application({
  port: 3000
});

app.listenHttp(router);

Start script in terminal:

$ node index.js
Server started on http://localhost:3000

app.close()

  • returns: <Promise> Following successful listen, the Promise is resolved with an value with a undefined.

Stops the server from accepting new connections.

app.server

In this variable, an instance of the server will be assigned after a successful listen installation.

app.context

This empty <Object>. You may add additional properties to inq.context by editing app.context.

app.context.db = db();

class Route

The router is made up of instances class Route.

router

Routing will be done:

| Method | URL | |--------|----------------------------------| | GET | http://example.com | | GET | http://example.com/catalog | | GET | http://example.com/logs_0 | | GET | http://example.com/logs_1 | | POST | http://example.com/catalog/books |

Extends the Node.js events module.

Event: 'error'

The 'error' event is emitted if throw an exception. The listener callback is passed a single Error argument when called. The server is not closed when the 'error' event is emitted.

constructor: new Route(options)

When defining a route in icore you need one basic element - the handler.

  • options <Object>
    • handler <AsyncFunction> takes an instance of a class Inquiry as context. The handler option must return a object, a promise, or throw an error.
    • path <String> The path option must be a string, though it can contain regular expression. Default: ''.
    • method <String> The property of the method can be any valid HTTP method in lower case letters. Default: 'get'.
    • finish <Boolean> If set to true, the find returns the current route. Default: false.

Simple example use Route class:

const homepage = new Route({
  async handler(inq) {
    return {
      status: 200,
      header: {
        'Content-Type': 'text/html; charset=utf-8'
      },
      body: 'Hello World!'
    };
  }
});

route.route(options)

Uses the same interface as the class constructor.

const catalog = homepage.route({
  method: 'catalog',
  async handler(inq) {
    return {};
  }
});

route.find(paths[, index])

This method is intended for class Application use.

  • paths <Array> The result of the transform of the URL.
  • index <Number> Is cursor for next call find. Default: 0.
  • returns: Returns null if the route is not found.

route.method

  • <String> The property of the method can be any valid HTTP method in lower case letters. Default: 'get'.

route.handler

  • <AsyncFunction> takes an instance of a class Inquiry as context. The handler option must return a object, a promise, or throw an error.

route.finish

  • <Boolean> If set to true, the find returns the current route. Default: false.

route.childs

  • <Array> Nested route list.

class Inquiry

A class Application context encapsulates node's request and response objects into a single object which provides many helpful methods for writing web applications and APIs.

constructor: new Inquiry(req, cookie)

The constructor will be auto called whenever a new request is established.

inq.read(options)

  • options <Object>
    • maxSize <Number> Limits the amount of memory all fields together (except files) can allocate in bytes. If this value is exceeded, an 'error' event is emitted. Default: Infinity.
  • returns: <Promise> Following successful listen, the Promise is resolved with an value with a string type.

To start reading the body of the incoming message.

async handler(inq) {
  const data = await inq.read();
}

inq.pipe(stream[, options])

  • stream <stream.Writable>
  • options <Object>
    • maxSize <Number> Limits the amount of memory all fields together (except files) can allocate in bytes. If this value is exceeded, an 'error' event is emitted. Default: Infinity.

To start reading the body of an incoming message as a stream

async handler(inq) {
  inq.pipe(writeStream);
}

inq.queries

  • <Object> Get raw query string void of ?.

inq.method

  • <String> The property of the method can be any valid HTTP method in lower case letters. Default: 'get'.

inq.headers

  • <Object> Response header object.

inq.context