Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
protected async setupStorage() {
CoreApp.storage = await this.storageAdapter.init();
CoreApp.adapter = await lowdb.default(CoreApp.storage);
}
private async initializeLayers() {
const adapter = await lowdb.default(this.storage);
const router = jsonServer.router(adapter);
const middlewares = jsonServer.defaults({
readOnly: this.appConfig.readOnly,
});
return { middlewares, router };
}
protected async initializeLayers() {
if (
CoreApp.adapter &&
Object.entries(CoreApp.adapter).length === 0 &&
CoreApp.adapter.constructor === Object
) {
CoreApp.adapter = await lowdb.default(CoreApp.storage);
}
const router = jsonServer.router(CoreApp.adapter);
const middlewares = jsonServer.defaults({
readOnly: this.appConfig.readOnly,
});
return { middlewares, router };
}