Skip to content

Instantly share code, notes, and snippets.

@onwuvic
Created May 11, 2020 07:22
Show Gist options
  • Save onwuvic/c113434907eac621b822aa31fbffafe3 to your computer and use it in GitHub Desktop.
Save onwuvic/c113434907eac621b822aa31fbffafe3 to your computer and use it in GitHub Desktop.
Post Service sample code
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