gengojs-default-router

The default router plugin for gengo.js.

Usage no npm install needed!

<script type="module">
  import gengojsDefaultRouter from 'https://cdn.skypack.dev/gengojs-default-router';
</script>

README

gengojs-default-router

The default router plugin for gengo.js.

Build Status

An example usage with options is:


var gengo = require('gengojs');
var router = require('gengojs-default-router');

/* In whatever framework you are using: */

// I'll use express for an example
// but it shouldn't matter

var app = require('express')();
app.use(gengo({
   // Specify the type
   // of option to modify
    router:{
        /* options */
    }
},/*router()*/));

Options

{
    "enabled":false
}

Internal API

  • this.router.toArray()
    • Should return the URL path as an array.
  • this.router.toDot()
    • Should return the URL path as an dotted string.
  • this.router.isEnabled()
    • Should return true if router is enabled.

Dependencies

Not Applicable

Debug

Unix:

DEBUG=gengo.router

Windows:

SET DEBUG=gengo.router

See gengojs-debug for usage.

Contribute

Feel free to contribute or even fork the project. This plugin has been written in ES6 and can be seen under lib/index.js.