#nomad
https://nomadcoders.co/nestjs-fundamentals/lobby
https://trilon.io/blog/deploy-nestjs-azure-functions
Deploy NestJS Serverless Apps to Azure Functions
Learn about the new NestJS Schematics and how to setup & deploy NestJS Serverless apps to Azure Functions in a few minutes!
trilon.io
$ npm i -g @nestjs/cli
$ nest new nest-azure-function
$ cd .\nest-azure-function\
$ nest add @nestjs/azure-func-http
$ func --version
$ npm run build
$ func host start
//swagger
https://docs.nestjs.com/openapi/introduction
$ npm install --save @nestjs/swagger swagger-ui-express
#main.azure.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
import { INestApplication } from '@nestjs/common';
import { NestFactory } from '@nestjs/core';
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
import { AppModule } from './app.module';
export async function createApp(): Promise<INestApplication> {
const app = await NestFactory.create(AppModule);
app.setGlobalPrefix('api');
const options = new DocumentBuilder().build();
const document = SwaggerModule.createDocument(app, options);
SwaggerModule.setup('api/docs', app, document);
await app.init();
return app;
}
|
cs |
#main.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { SwaggerModule, DocumentBuilder } from "@nestjs/swagger";
async function bootstrap() {
const app = await NestFactory.create(AppModule);
const config = new DocumentBuilder()
.setTitle('Payment')
.setDescription('The payment API description')
.setVersion('1.0')
.build();
const document = SwaggerModule.createDocument(app, config);
SwaggerModule.setup('api', app, document);
await app.listen(3000);
}
bootstrap();
|
cs |
//Swagger 작성
https://jhyeok.com/nestjs-swagger/
//azure + swagger
//localhost + swagger test
// * main.ts > port & setup 확인
$ npm run start
>> http://localhost:3000/api/
----------------------------------- add -----------------------------------
//sequelize
$ npm add @nestjs/sequelize mysql2 sequelize sequelize-typescript @types/sequelize
----------------------------------- add -----------------------------------
//typeorm
$ npm install --save @nestjs/typeorm typeorm mariadb
따라하며 배우는 NestJS - 인프런 | 학습 페이지
지식을 나누면 반드시 나에게 돌아옵니다. 인프런을 통해 나의 지식에 가치를 부여하세요....
www.inflearn.com
#folder
# configs/typeorm.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
import {TypeOrmModuleOptions} from "@nestjs/typeorm";
export const typeORMConfig : TypeOrmModuleOptions = {
type: 'mariadb',
host: 'localhost',
port: 3306,
username: 'root',
password: 'root',
database: 'root',
entities: [__dirname + '/../**/*.entity.{js,ts}'],
synchronize: false,
autoLoadEntities: true
}
|
cs |
--------- DTO ---------
#ValidationPipe
$ npm i --save class-validator class-transformer
- https://docs.nestjs.kr/techniques/validation
''o'' 카테고리의 다른 글
[크롬] 크롬 개발자도구 붙여놓기 오류 (0) | 2024.02.06 |
---|---|
[rust] windows10 ERROR (0) | 2021.11.15 |
[MailU] (0) | 2021.10.08 |
[Vue] tsc && vue-cli-service --build Error 오류 (0) | 2021.10.08 |
[Vue] vuejs-daum-postcode 다음 주소 검색 modal (0) | 2021.09.27 |