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

adonisjs-cote-router

v0.0.4

Published

AdonisJS Framework compitable route management system for cote microservice discovery

Readme

AdonisJS Cote Router

Using this package it is easy to use default route registration similar to what adonis provides.

Note: This package is under active development

Install

Change to your project directory and run the following command in your favourite terminal:

npm install adonis-cote-router

Usage:

To use package discovery AdonisJS requires some configuration.

In your application starting script you should have something like following:

const { Ignitor } = require("@adonisjs/ignitor");

new Ignitor(require("@adonisjs/fold"));

This initialize the Ignitor or the package that fires up AdonisJS framework

I found it conveinient to create a new file in start directory named cote.js to contain all the codes specific to cote and preload the file in the ignitor as following:

new Ignitor(require("@adonisjs/fold")).preLoad("./start/cote");

And inside the cote.js file I require the routes and then invoke listen method.

const Router = require("../routes");

const redisHOST = process.env.COTE_DISCOVERY_REDIS_HOST;
const redisPORT = process.env.COTE_DISCOVERY_REDIS_PORT;

Router.prepare(redisHOST, redisPORT, {
  name: "App Service",
  key: "app-microservice",
  port: 5401
});

Router.listen();

To keep http routes and cote routes seperate I create a new directory named routes in the root directory and reference it from the cote.js as shown earlier.

Inside routes directory I keep an index.js file where I put all my cote routes.

const Router = require("adonisjs-cote-router");

Router.get("/", "HomeController@index");

Router.post("/user", "UserController@store");
Router.put("/user", "UserController@update");
Router.delete("/user", "UserController@delete");

Currently the route path doesn't support router parameters yet but soon they will be supported.

To able to discover automatically the controllers must recide inside app\Controllers\Http directory. In near future I plan to work on keeping the routes related to cote inside its own directory like app\Controllers\Cote

By default Cote is not statefull which means it does not care about the HTTP methods. But its nice to group the routes based on their methods and it will improve readability.

Router class has the following public api's:

get/post/put/delete Generic route create methods

namespace to create a new namespaced route groups

Router.namespace("admin", () => {
  Router.get("/", "AdminController@index"); // route: `admin/get/`
  Router.get("/profile", "AdminController@index"); // route `admin/get/profile`
});

group to create a route group

Router.group(() => {
  Router.get("/", "AdminController@index");
  Router.get("/profile", "AdminController@index");
}).middleware("Authticate");

Groupped routes doesn't add anything with the route path but they are particularly useful for creating middleware like the example above. Middlewares are also subject to auto discovery. Cote middlewares are exactly same as AdonisJS middlewares, they are classes resided in the app\Middlewares directory with handle method which is actually invoked when the middleware is executed.

Middlewares are available to both namespace, group and get/post/put/delete methods. Chaining a middleware mehtod at the end with an array of middleware class names or a single one will add them with the namespaced/groupped/single route

This is an early development of this project and subject to flaws. If you experience any then it will be really helpful if you can open an issue.

Thank you for having interest on this. Any help is appreciated.