How to use @eggjs/router - 2 common examples

To help you get started, we’ve selected a few @eggjs/router examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github eggjs / egg-core / lib / egg.js View on Github external
get router() {
    if (this[ROUTER]) {
      return this[ROUTER];
    }
    const router = this[ROUTER] = new Router({ sensitive: true }, this);
    // register router middleware
    this.beforeStart(() => {
      this.use(router.middleware());
    });
    return router;
  }
github midwayjs / midway / packages / midway-web / src / loader / webLoader.ts View on Github external
private createEggRouter(controllerOption: ControllerOption) {
    const { prefix, routerOptions: { sensitive } } = controllerOption;
    if (prefix) {
      const router = new Router({ sensitive }, this.app);
      router.prefix(prefix);
      return router;
    }
    return null;
  }

@eggjs/router

Router middleware for egg/koa. Provides RESTful resource routing.

MIT
Latest version published 6 months ago

Package Health Score

74 / 100
Full package analysis

Popular @eggjs/router functions