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

ocko

v1.0.0

Published

Očko [otʃko] is a tool for easy&lite checking your websites or http applications.

Downloads

6

Readme

OČKO

OČKO

Očko [otʃko] is a tool for easy&lite checking your websites or http applications.

Install

$ npm install -g ocko

Create configuration file

$ ocko --init ./configuration.js

Update the file ./configuration.js!

Run

$ ocko ./configuration.js

Use ocko in your node project

const ocko = require('ocko');

ocko(configuration);

Configuration

All configuration is in array. You can check all of your websites.

url

A url or IP address of the server to issue the request to.

type: string
example: https://google.com

timeout

Time delay to next check [min].

type: number
example: 60

response

Object to deep compare with HttpResponse of node.

type: { [key: string]: mixed }
default value: { statusCode: 200 }

mailFrom

Mail from send errors or/and successes.

type: string
example: [email protected]

mails

Mails to send errors or/and successes.

type: Array<{ sentSuccess?: boolean, sentErrors?: boolean,mail: string }>
default value: { sentSuccess: false, sentErrors: true }
example: [ { mail: "[email protected]" }, ]

check

Your own method to check

type: ?(body: string, response: HttpResponse) => { successes: Array< string >, errors: Array< string > }
example:

(body) => {
    let errors = [];
    let successes = [];

    try {
        const bodyInJson = JSON.parse(body);
        if (bodyInJson.statusCode === 401) {
            successes.push("My API is o.k. ;-)");
        } else {
            errors.push("My API doesn't work :(");
        }
    } catch (e) { 
         errors.push("Response is not JSON.");
    }

    return { errors, successes };
}

Examples

Example of a statement to the console:

2018-7-16 19:50:05 Check "http://github.com/":
    ✘ The property "statusCode" of request is not equal with defined. Defined: 200, response: 301.
    ! Mails with errors are being sent to [email protected].

2018-7-16 19:50:10 Check "http://sdjilm.cz/api/pagemenu":
    ✓ The property "statusCode" of request is equal with defined: 200.
    ✓ Response is JSON.
    ✓ My API is o.k. ;-)

2018-7-16 19:50:12 Check "https://google.cz/":
    ✓ The property "statusCode" of request is equal with defined: 200.

Example of received e-mail:

The checking of "http://github.com/" caused following errors:
    ✘ The property "statusCode" of request is not equal with defined. Defined: 200, response: 301.