Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lark-router

Package Overview
Dependencies
Maintainers
3
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lark-router

An koa route initialization and configuration module.

  • 0.3.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-88.24%
Maintainers
3
Weekly downloads
 
Created
Source

lark-router

Route configuration middleware for koajs.

NPM version build status

Installation

$ npm install lark-router

API

app.use(router(options))
var koa = require('koa');
var router = require('lark-router');
var app = koa();

app.use(router({directory:'controllers'}));

app.listen(3002);
directory

The directory configuration option (optional) is the path to a directory. Specify a directory to have lark-router scan all files recursively to find files that match the controller-spec API. With this API, the directory structure dictates the paths at which handlers will be mounted.

controllers
 |-user
     |-create.js
     |-list.js
 |-product
     |-index.js
// create.js
module.exports = function(router){
  router.get('/', function *(next){
    this.body = 'Hello koa';
    yield next;
  });
  return router;
};
app.use(bootstrap({
    directory: 'controllers'
}));

Routes are now:

/user/create
/user/list
/product

Tests

npm test

Keywords

FAQs

Package last updated on 18 Mar 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc