Created
May 11, 2020 07:22
-
-
Save onwuvic/c113434907eac621b822aa31fbffafe3 to your computer and use it in GitHub Desktop.
Post Service sample code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@nestjs/common'; | |
import { Post } from './interfaces/post.interface'; | |
@Injectable() | |
export class PostsService { | |
private readonly posts: Post[] = []; | |
create(post: Post) { | |
this.posts.push(post); | |
} | |
findAll(): Post[] { | |
return this.posts; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment