How to use the midway-web.priority function in midway-web

To help you get started, we’ve selected a few midway-web 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 midwayjs / sandbox / packages / sandbox-core / src / app / controller / metricsCtrl.ts View on Github external
import { inject, get, controller, provide, priority } from 'midway-web';

import {MetricsUtils} from '../util/metricsUtils';
import {MetricNameJSON} from '../../interface/services/common';

@priority(0)
@provide()
@controller('/v2/api/metrics/')
export class MetricsCtrl {

  @inject('metricsService')
  private metricsService;

  @get('/getMetricsNames')
  async getMetricsNames(ctx) {

    const query = ctx.query;
    const {scope, scopeName, env} = query;
    const data = await this.metricsService.getMetricsNames({
      scope, scopeName, env,
    });
    ctx.body = {