Initial commit: UlHub workspace
This commit is contained in:
12
backend/src/app.controller.ts
Normal file
12
backend/src/app.controller.ts
Normal file
@@ -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() {
|
||||
return this.appService.getHello();
|
||||
}
|
||||
}
|
||||
11
backend/src/app.module.ts
Normal file
11
backend/src/app.module.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { AppController } from './app.controller';
|
||||
import { AppService } from './app.service';
|
||||
import { StatusController } from './status.controller';
|
||||
|
||||
@Module({
|
||||
imports: [],
|
||||
controllers: [AppController, StatusController],
|
||||
providers: [AppService],
|
||||
})
|
||||
export class AppModule {}
|
||||
11
backend/src/app.service.ts
Normal file
11
backend/src/app.service.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
|
||||
@Injectable()
|
||||
export class AppService {
|
||||
getHello() {
|
||||
return {
|
||||
message: 'Welcome to UlHub API',
|
||||
docs: 'GET /api'
|
||||
};
|
||||
}
|
||||
}
|
||||
10
backend/src/main.ts
Normal file
10
backend/src/main.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { AppModule } from './app.module';
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule);
|
||||
app.setGlobalPrefix('api');
|
||||
await app.listen(3001, '0.0.0.0');
|
||||
}
|
||||
|
||||
bootstrap();
|
||||
12
backend/src/status.controller.ts
Normal file
12
backend/src/status.controller.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { Controller, Get } from '@nestjs/common';
|
||||
|
||||
@Controller('status')
|
||||
export class StatusController {
|
||||
@Get()
|
||||
getStatus() {
|
||||
return {
|
||||
status: 'ok',
|
||||
service: 'UlHub API',
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user