简体   繁体   English

模块“./datasources”没有导出的成员“DbDataSource”。 环回

[英]Module '“./datasources”' has no exported member 'DbDataSource'. loopback

I am trying to authenticate a loopback API but I am getting Module '"./datasources"' has no exported member 'DbDataSource'.我正在尝试对环回 API 进行身份验证,但我得到的模块“./datasources”没有导出成员“DbDataSource”。

In my application.ts I have在我的 application.ts 我有

import {BootMixin} from '@loopback/boot';
import {RepositoryMixin} from '@loopback/repository';
import {RestApplication, OpenApiBuilder, ServerObject} from '@loopback/rest';
import {ServiceMixin} from '@loopback/service-proxy';
import {MySequence} from './sequence';
import {
  AuthenticationBindings,
  UsersBindings, 
  AssetsBindings,
  SubjectsBindings,
  CoursesBindings
} from './keys';
import {
  AuthenticationService,
  UsersService, 
  AssetsService, 
  CoursesService,
  SubjectsService
} from './services'

import {AuthenticationComponent} from '@loopback/authentication';
import {
  JWTAuthenticationComponent,
  SECURITY_SCHEME_SPEC,
  UserServiceBindings,
} from '@loopback/authentication-jwt';
import {DbDataSource} from './datasources';


export class AtgCodeApplication extends BootMixin(
  ServiceMixin(RepositoryMixin(RestApplication)),
) {
  private static instance: AtgCodeApplication;
  constructor(options: ApplicationConfig = {}) {
    super({
      rest: {
        cors: {}
      }
    });

I am getting Module '"./datasources"' has no exported member 'DbDataSource'.我得到Module '"./datasources"' has no exported member 'DbDataSource'. with DbDataSource and also getting Cannot find name 'ApplicationConfig'.使用 DbDataSource 并且还Cannot find name 'ApplicationConfig'. and Parameter 'options' of constructor from exported class has or is using private name 'ApplicationConfig'.Parameter 'options' of constructor from exported class has or is using private name 'ApplicationConfig'. in ApplicationConfig在应用程序配置中

I am using the auth procedure in https://loopback.io/doc/en/lb4/Authentication-tutorial.html#step-1-bind-jwt-component-in-the-application as a guild.我正在使用https://loopback.io/doc/en/lb4/Authentication-tutorial.html#step-1-bind-jwt-component-in-the-application作为公会的身份验证程序。

How can I fix these errors please.请问我该如何解决这些错误。

Your application.ts seems a bit outdated.您的application.ts似乎有点过时了。 You might want to check with https://github.com/strongloop/loopback-next/blob/master/examples/todo-jwt/src/application.ts as a reference.您可能需要检查https://github.com/strongloop/loopback-next/blob/master/examples/todo-jwt/src/application.ts作为参考。

For the DbDataSource issue, it is the DataSource you've created to store the User data.对于DbDataSource问题,它是您为存储用户数据而创建的 DataSource。 It might be of a different name.它可能具有不同的名称。

Overall, you can download the latest todo-jwt example by running lb4 example todo-jwt command.总体而言,您可以通过运行lb4 example todo-jwt命令下载最新的todo-jwt示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM