How to use the @loopback/rest.RestBindings.PORT function in @loopback/rest

To help you get started, we’ve selected a few @loopback/rest 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 strongloop / loopback-next / packages / example-codehub / src / codehub-application.ts View on Github external
async info() {
    const server: RestServer = await this.getServer(RestServer);
    const port: Number = await server.get(RestBindings.PORT);

    return {
      uptime: Date.now() - this._startTime.getTime(),
      // TODO(bajtos) move this code to Application, the URL should
      // be accessible via this.get('http.url')
      url: 'http://127.0.0.1:' + port,
    };
  }
}
github strongloop / loopback4-example-microservices / services / transaction / src / index.ts View on Github external
async function info() {
    const rest = await app.getServer(RestServer);
    const port = await rest.get(RestBindings.PORT);
    return {
      appName: 'transcation',
      uptime: Date.now() - app._startTime.getTime(),
      url: `http://127.0.0.1:${port}`,
    };
  }
}
github strongloop / loopback4-example-microservices / services / customer / src / index.ts View on Github external
async function info() {
    const rest = await app.getServer(RestServer);
    const port = await rest.get(RestBindings.PORT);
    return {
      appName: 'customer',
      uptime: Date.now() - app._startTime.getTime(),
      url: `http://127.0.0.1:${port}`,
    };
  }
}
github strongloop / loopback4-example-microservices / services / account-without-juggler / index.ts View on Github external
async info() {
    const rest = await this.getServer(RestServer);
    const port: Number = await rest.get(RestBindings.PORT);
    return {
      appName: 'account',
      uptime: Date.now() - this._startTime.getTime(),
      url: `http://127.0.0.1:${port}`,
    };
  }
}
github strongloop / loopback-next / packages / example-codehub / src / codehub-application.ts View on Github external
server.then(s => {
      s.api({
        swagger: '2.0',
        info: {
          title: 'CodeHub',
          version: require('../package.json').version,
        },
        basePath: '/',
        paths: {},
      });

      s.bind(RestBindings.PORT).to(3000);
    });
github strongloop / loopback4-example-microservices / services / facade / src / index.ts View on Github external
async function info() {
    const rest = await app.getServer(RestServer);
    const port = await rest.get(RestBindings.PORT);
    return {
      appName: 'facade',
      uptime: Date.now() - app._startTime.getTime(),
      url: `http://127.0.0.1:${port}`,
    };
  }
}
github strongloop / loopback4-example-microservices / services / account / src / index.ts View on Github external
async function info() {
    const rest = await app.getServer(RestServer);
    const port = await rest.get(RestBindings.PORT);
    return {
      appName: 'account',
      uptime: Date.now() - app._startTime.getTime(),
      url: `http://127.0.0.1:${port}`,
    };
  }
}