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 🙏

© 2026 – Pkg Stats / Ryan Hefner

cealloga

v0.3.0

Published

Simple microservices on demand

Readme

cealloga

Build Status Coverage Status npm version Documentation Vulnerabilities

Ceallóga are simple ES6 arrow functions. Validate, test, and publish them as web service endpoints, and do it all via an easy-to-use rest API.

Requirements

Install

npm install -g cealloga

Run

cealloga

Getting started

In this tutorial, we'll create a microservice that:

  • takes information from a raw data source called colours
  • sums the colours up and returns them as an object called chartData (something you might later consume in an UI component such as a bar chart, for example.)

Before we begin, let's dissect the uncompressed source code we want to host as a web service.

(ceallog) => {
    let colours = ceallog.vars.colours, // A list of colours, POSTed by the user in the request body.
        coloursMap = {}, // A map of colours, where key will be colour name ('yellow') and value a total (`2`).
        chartData = {labels: [], series: []} // Chart data to build from incoming colours
    
    if (colours) { // Sum the colours...
        colours.forEach(c => coloursMap[c.name] = coloursMap[c.name] + 1 || 1);
    }
    
    for (var name in coloursMap) { // Push the `name` into labels and `total` into series in the same order.
        let total = coloursMap[name];
        
        chartData.labels.push(name);
        chartData.series.push(total);
    }
    
    return chartData;
}

Validate

We create our code by first posting it to the /code/validate service. When we do this, the request is validated, the code is compiled, it's added to the database and cached on the server, and finally we receive a response with some information about it.

  1. Save the following file as barchart.json.
{
   "name":"barchart",
   "label":"Colour Total Bar Chart",
   "body":"(ceallog)=>{let colours=ceallog.vars.colours,coloursMap={},chartData={labels:[],series:[]};if(colours){colours.forEach(c=>coloursMap[c.name]=coloursMap[c.name]+1||1)}for(var name in coloursMap){let total=coloursMap[name];chartData.labels.push(name);chartData.series.push(total)}return chartData;}"
}
  1. In a terminal, run this curl command from the same directory as barchart.json:
curl -H "Content-Type: application/json" -X POST -d @barchart.json http://localhost:3000/code/validate

You should now have a response like the following. Copy the "service" value; you'll need it in the next example!

{
   "compiled":true,
   "id":"5a610660158ffae3135b7c7e",
   "created_date":"2018-01-18T20:41:04.849Z",
   "label":"Colour Total Bar Chart",
   "message":"Resource retrieved successfully.",
   "name":"barchart",
   "published":false,
   "service":"/cealloga/_test/5a610660158ffae3135b7c7e"
}

Test

Now that the code has been validated and created, let's send it some colour data and test the results.

  1. Save the following file as colours.json.
{"colours": [{"name": "blue"}, {"name": "yellow"}, {"name": "red"}, {"name": "yellow"}]}
  1. In a terminal, run this curl command from the same directory as colours.json:
curl -H "Content-Type: application/json" -X POST -d @colours.json http://localhost:3000/cealloga/_test/5a610660158ffae3135b7c7e # <- replace with your _test endpoint from the validate example

If you're seeing the following, it worked!

{
   "labels":[
      "blue",
      "yellow",
      "red"
   ],
   "series":[
      1,
      2,
      1
   ]
}

Publish

Once we're happy with the test results, we can publish the function by name as /cealloga/barchart.

Run the following curl command.

curl http://localhost:3000/code/publish/5a610660158ffae3135b7c7e # <- replace with the id from the validate example 

You should get a response like the following:

{
   "body":"(ceallog)=>{let colours=ceallog.vars.colours,coloursMap={},chartData={labels:[],series:[]};if(colours){colours.forEach(c=>coloursMap[c.name]=coloursMap[c.name]+1||1)}for(var name in coloursMap){let total=coloursMap[name];chartData.labels.push(name);chartData.series.push(total)}return chartData;}",
   "compiled":true,
   "created_date":"2018-01-18T20:41:04.849Z",
   "id":"5a610660158ffae3135b7c7e",
   "label":"Colour Total Bar Chart",
   "name":"barchart",
   "published":true,
   "service":"/cealloga/barchart"
}

Making a request to the published endpoint

The only thing left to day at this point is to check that /cealloga/barchart is up and running.

In a terminal, run this curl command from the same directory as colours.json:

curl -H "Content-Type: application/json" -X POST -d @colours.json http://localhost:3000/cealloga/barchart

As in the test example above, if you're seeing the following, it worked again!

{
   "labels":[
      "blue",
      "yellow",
      "red"
   ],
   "series":[
      1,
      2,
      1
   ]
}