Skip to content

Instantly share code, notes, and snippets.

@nishabe
Last active January 7, 2021 15:06
Show Gist options
  • Save nishabe/9f5d4fcd23bdadb04b5ede4509500a14 to your computer and use it in GitHub Desktop.
Save nishabe/9f5d4fcd23bdadb04b5ede4509500a14 to your computer and use it in GitHub Desktop.
api.service.ts
import { HttpService, Injectable } from '@nestjs/common';
import { Student } from '../student/student.service';
@Injectable()
export class ApiService {
constructor(private http: HttpService) {}
async getStudent(firstName: string, lastName: string): Promise<Student> {
const url = `../get-student?firstName=${firstName}&lastName=${lastName}`;
const response = await this.http.get(url).toPromise();
return response.data;
}
getHello(): string {
return 'Hello World!';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment