引入Post,新建两个方法:findAll,create

This commit is contained in:
Jeremy Yin 2019-06-18 21:12:44 +08:00
parent c319205215
commit b56361bfad
1 changed files with 12 additions and 1 deletions

View File

@ -1,4 +1,15 @@
import { Injectable } from '@nestjs/common';
import { Post } from 'src/posts/interfaces/post.interface';
@Injectable()
export class DemoService {}
export class DemoService {
private readonly posts: Post[] = [];
findAll(): Post[] {
return this.posts;
}
create(post: Post) {
this.posts.push(post);
}
}