nest generate controller posts

This commit is contained in:
Jeremy Yin 2019-06-17 22:20:54 +08:00
parent 40ff4c3fc2
commit 396ffae09e
3 changed files with 24 additions and 1 deletions

View File

@ -1,10 +1,11 @@
import { Module } from '@nestjs/common'; import { Module } from '@nestjs/common';
import { AppController } from './app.controller'; import { AppController } from './app.controller';
import { AppService } from './app.service'; import { AppService } from './app.service';
import { PostsController } from './posts/posts.controller';
@Module({ @Module({
imports: [], imports: [],
controllers: [AppController], controllers: [AppController, PostsController],
providers: [AppService], providers: [AppService],
}) })
export class AppModule {} export class AppModule {}

View File

@ -0,0 +1,18 @@
import { Test, TestingModule } from '@nestjs/testing';
import { PostsController } from './posts.controller';
describe('Posts Controller', () => {
let controller: PostsController;
beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
controllers: [PostsController],
}).compile();
controller = module.get<PostsController>(PostsController);
});
it('should be defined', () => {
expect(controller).toBeDefined();
});
});

View File

@ -0,0 +1,4 @@
import { Controller } from '@nestjs/common';
@Controller('posts')
export class PostsController {}