summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/app.controller.spec.ts22
-rw-r--r--src/app.controller.ts12
-rw-r--r--src/app.module.ts10
-rw-r--r--src/app.service.ts8
-rw-r--r--src/main.ts8
5 files changed, 60 insertions, 0 deletions
diff --git a/src/app.controller.spec.ts b/src/app.controller.spec.ts
new file mode 100644
index 0000000..d22f389
--- /dev/null
+++ b/src/app.controller.spec.ts
@@ -0,0 +1,22 @@
+import { Test, TestingModule } from '@nestjs/testing';
+import { AppController } from './app.controller';
+import { AppService } from './app.service';
+
+describe('AppController', () => {
+ let appController: AppController;
+
+ beforeEach(async () => {
+ const app: TestingModule = await Test.createTestingModule({
+ controllers: [AppController],
+ providers: [AppService],
+ }).compile();
+
+ appController = app.get<AppController>(AppController);
+ });
+
+ describe('root', () => {
+ it('should return "Hello World!"', () => {
+ expect(appController.getHello()).toBe('Hello World!');
+ });
+ });
+});
diff --git a/src/app.controller.ts b/src/app.controller.ts
new file mode 100644
index 0000000..cce879e
--- /dev/null
+++ b/src/app.controller.ts
@@ -0,0 +1,12 @@
+import { Controller, Get } from '@nestjs/common';
+import { AppService } from './app.service';
+
+@Controller()
+export class AppController {
+ constructor(private readonly appService: AppService) {}
+
+ @Get()
+ getHello(): string {
+ return this.appService.getHello();
+ }
+}
diff --git a/src/app.module.ts b/src/app.module.ts
new file mode 100644
index 0000000..8662803
--- /dev/null
+++ b/src/app.module.ts
@@ -0,0 +1,10 @@
+import { Module } from '@nestjs/common';
+import { AppController } from './app.controller';
+import { AppService } from './app.service';
+
+@Module({
+ imports: [],
+ controllers: [AppController],
+ providers: [AppService],
+})
+export class AppModule {}
diff --git a/src/app.service.ts b/src/app.service.ts
new file mode 100644
index 0000000..927d7cc
--- /dev/null
+++ b/src/app.service.ts
@@ -0,0 +1,8 @@
+import { Injectable } from '@nestjs/common';
+
+@Injectable()
+export class AppService {
+ getHello(): string {
+ return 'Hello World!';
+ }
+}
diff --git a/src/main.ts b/src/main.ts
new file mode 100644
index 0000000..13cad38
--- /dev/null
+++ b/src/main.ts
@@ -0,0 +1,8 @@
+import { NestFactory } from '@nestjs/core';
+import { AppModule } from './app.module';
+
+async function bootstrap() {
+ const app = await NestFactory.create(AppModule);
+ await app.listen(3000);
+}
+bootstrap();