Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);
}
function givenRestApplication(config?: RestServerConfig) {
const rest = Object.assign({}, givenHttpServerConfig(), config);
return new RestApplication({rest});
}
function givenRestApplication(config?: RestServerConfig) {
const rest = Object.assign({}, givenHttpServerConfig(), config);
return new RestApplication({rest});
}
});
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);
}
async function givenAnApp() {
app = new RestApplication();
app.component(AuthenticationComponent);
}