File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { HTTPDataSource } from "apollo-datasource-http" ;
22import { LanyardAPIData } from "./interfaces" ;
33import { Pool } from "undici" ;
4+ import { API_URL } from "./constants" ;
45
5- const pool = new Pool ( "https://api.lanyard.rest" ) ;
6+ const pool = new Pool ( API_URL ) ;
67
78export default class LanyardAPI extends HTTPDataSource {
89 constructor ( ) {
9- super ( "https://api.lanyard.rest" , {
10+ super ( API_URL , {
1011 pool,
1112 clientOptions : {
1213 bodyTimeout : 5000 ,
@@ -16,6 +17,6 @@ export default class LanyardAPI extends HTTPDataSource {
1617 }
1718
1819 async getUser ( user : string ) : Promise < LanyardAPIData > {
19- return ( await this . get ( " /v1/users/" + user ) ) as unknown as LanyardAPIData ;
20+ return ( await this . get ( ` /v1/users/${ user } ` ) ) as unknown as LanyardAPIData ;
2021 }
2122}
Original file line number Diff line number Diff line change 1- import LanyardAPI from "./DataSource" ;
2-
31export interface LanyardAPIData {
42 success : boolean ;
53 data : Data ;
Original file line number Diff line number Diff line change 1- import server from "./Server " ;
1+ import server from "./server " ;
22
33server
44 . listen ( 8080 )
Original file line number Diff line number Diff line change 1- import LanyardAPI from "../DataSource" ;
21import { LanyardAPIData } from "../interfaces" ;
32
43const Query = {
Original file line number Diff line number Diff line change 11import { ApolloServer } from "apollo-server" ;
2- import LanyardAPI from "./DataSource " ;
2+ import LanyardAPI from "./data-source " ;
33import resolvers from "./resolvers" ;
44import typeDefs from "./schema" ;
55
You can’t perform that action at this time.
0 commit comments