nest install module service & controller for url-shortener
This commit is contained in:
parent
a24ff578a8
commit
ac79ea9ad3
6 changed files with 57 additions and 1 deletions
|
@ -1,9 +1,10 @@
|
|||
import { Module } from '@nestjs/common';
|
||||
import { AppController } from './app.controller';
|
||||
import { AppService } from './app.service';
|
||||
import { UrlShortenerModule } from './url-shortener/url-shortener.module';
|
||||
|
||||
@Module({
|
||||
imports: [],
|
||||
imports: [UrlShortenerModule],
|
||||
controllers: [AppController],
|
||||
providers: [AppService],
|
||||
})
|
||||
|
|
18
src/url-shortener/url-shortener.controller.spec.ts
Normal file
18
src/url-shortener/url-shortener.controller.spec.ts
Normal file
|
@ -0,0 +1,18 @@
|
|||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { UrlShortenerController } from './url-shortener.controller';
|
||||
|
||||
describe('UrlShortenerController', () => {
|
||||
let controller: UrlShortenerController;
|
||||
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
controllers: [UrlShortenerController],
|
||||
}).compile();
|
||||
|
||||
controller = module.get<UrlShortenerController>(UrlShortenerController);
|
||||
});
|
||||
|
||||
it('should be defined', () => {
|
||||
expect(controller).toBeDefined();
|
||||
});
|
||||
});
|
6
src/url-shortener/url-shortener.controller.ts
Normal file
6
src/url-shortener/url-shortener.controller.ts
Normal file
|
@ -0,0 +1,6 @@
|
|||
import { Controller } from '@nestjs/common';
|
||||
|
||||
@Controller('url-shortener')
|
||||
export class UrlShortenerController {
|
||||
|
||||
}
|
9
src/url-shortener/url-shortener.module.ts
Normal file
9
src/url-shortener/url-shortener.module.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
import { Module } from '@nestjs/common';
|
||||
import { UrlShortenerService } from './url-shortener.service';
|
||||
import { UrlShortenerController } from './url-shortener.controller';
|
||||
|
||||
@Module({
|
||||
providers: [UrlShortenerService],
|
||||
controllers: [UrlShortenerController]
|
||||
})
|
||||
export class UrlShortenerModule {}
|
18
src/url-shortener/url-shortener.service.spec.ts
Normal file
18
src/url-shortener/url-shortener.service.spec.ts
Normal file
|
@ -0,0 +1,18 @@
|
|||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { UrlShortenerService } from './url-shortener.service';
|
||||
|
||||
describe('UrlShortenerService', () => {
|
||||
let service: UrlShortenerService;
|
||||
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
providers: [UrlShortenerService],
|
||||
}).compile();
|
||||
|
||||
service = module.get<UrlShortenerService>(UrlShortenerService);
|
||||
});
|
||||
|
||||
it('should be defined', () => {
|
||||
expect(service).toBeDefined();
|
||||
});
|
||||
});
|
4
src/url-shortener/url-shortener.service.ts
Normal file
4
src/url-shortener/url-shortener.service.ts
Normal file
|
@ -0,0 +1,4 @@
|
|||
import { Injectable } from '@nestjs/common';
|
||||
|
||||
@Injectable()
|
||||
export class UrlShortenerService {}
|
Loading…
Reference in a new issue