How to use the @tsed/graphql.DataSourceService function in @tsed/graphql

To help you get started, we’ve selected a few @tsed/graphql 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 TypedProject / ts-express-decorators / docs / tutorials / snippets / graphql / datasource-service.ts View on Github external
import {DataSourceService} from "@tsed/graphql";
import {RESTDataSource} from "apollo-datasource-rest";
import {User} from "../models/User";

@DataSourceService()
export class UserDataSource extends RESTDataSource {
  constructor() {
    super();
    this.baseURL = "https://myapi.com/api/users";
  }

  getUserById(id: string): Promise {
    return this.get(`/${id}`);
  }
}

@tsed/graphql

GraphQL package for Ts.ED framework, based on Apollo-server-express and Type-graphql

MIT
Latest version published 3 years ago

Package Health Score

59 / 100
Full package analysis

Popular @tsed/graphql functions