nestjs tutorial for beginners

Solutions on MaxInterview for nestjs tutorial for beginners by the best coders in the world

showing results for - "nestjs tutorial for beginners"
Alessia
10 Jan 2021
1    getCourses(): Promise<any> {
2        return new Promise(resolve => {
3            resolve(this.courses);
4        });
5    }
6
7    getCourse(courseId): Promise<any> {
8        let id = Number(courseId);
9        return new Promise(resolve => {
10            const course = this.courses.find(course => course.id === id);
11            if (!course) {
12                throw new HttpException('Course does not exist', 404)
13            }
14            resolve(course);
15        });
16    }
Maya
25 Mar 2020
1import { Injectable, HttpException } from '@nestjs/common';
2import { COURSES } from './courses.mock';
3
4@Injectable()
5export class CoursesService {
6    courses = COURSES;
7}
similar questions
nestjs cluster service