21 lines
490 B
TypeScript
21 lines
490 B
TypeScript
import { Controller, Get } from '@nestjs/common';
|
|
import { InjectRepository } from '@nestjs/typeorm';
|
|
import { Repository } from 'typeorm';
|
|
import TechEntity from '../entity/tech';
|
|
@Controller('/tech')
|
|
export default class TechController {
|
|
@InjectRepository(TechEntity)
|
|
private tech: Repository<TechEntity>;
|
|
|
|
@Get('/t1')
|
|
getT1() {
|
|
return 'T1';
|
|
}
|
|
/// 数据库查询 裙查询
|
|
@Get('/t2')
|
|
async getT2() {
|
|
const techs = await this.tech.find();
|
|
return techs;
|
|
}
|
|
}
|