How to use the @loopback/rest.RestApplication 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 / rest-crud / src / __tests__ / acceptance / default-model-crud-rest.acceptance.ts View on Github external
repo = new ProductRepository(db);

    const CrudRestController = defineCrudRestController<
      Product,
      typeof Product.prototype.id,
      'id'
    >(Product, {basePath: '/products'});

    class ProductController extends CrudRestController {
      constructor() {
        super(repo);
      }
    }

    app = new RestApplication({rest: givenHttpServerConfig()});
    app.controller(ProductController);

    await app.start();
    client = createRestAppClient(app);
  }
github strongloop / loopback-next / packages / rest-explorer / src / __tests__ / acceptance / rest-explorer.acceptance.ts View on Github external
function givenRestApplication(config?: RestServerConfig) {
    const rest = Object.assign({}, givenHttpServerConfig(), config);
    return new RestApplication({rest});
  }
github strongloop / loopback-next / extensions / health / src / __tests__ / acceptance / health.acceptance.ts View on Github external
function givenRestApplication(config?: RestServerConfig) {
    const rest = Object.assign({}, givenHttpServerConfig(), config);
    return new RestApplication({rest});
  }
});
github strongloop / loopback-next / packages / rest-explorer / src / __tests__ / acceptance / rest-explorer.express.acceptance.ts View on Github external
async function givenLoopBackApp(
    options: {rest: RestServerConfig} = {rest: {port: 0}},
    explorerConfig?: RestExplorerConfig,
  ) {
    options.rest = givenHttpServerConfig(options.rest);
    const app = new RestApplication(options);
    if (explorerConfig) {
      app.bind(RestExplorerBindings.CONFIG).to(explorerConfig);
    }
    app.component(RestExplorerComponent);
    server = await app.getServer(RestServer);
  }