nestjs tutorial for beginners
getCourses(): Promise<any> {
return new Promise(resolve => {
resolve(this.courses);
});
}
getCourse(courseId): Promise<any> {
let id = Number(courseId);
return new Promise(resolve => {
const course = this.courses.find(course => course.id === id);
if (!course) {
throw new HttpException('Course does not exist', 404)
}
resolve(course);
});
}