Ajuste versão das lib e atualização para nest 11
This commit is contained in:
2169
package-lock.json
generated
2169
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
17
package.json
17
package.json
@@ -21,12 +21,15 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@nestjs/axios": "^3.1.3",
|
||||
"@nestjs/common": "^7.5.1",
|
||||
"@nestjs/core": "^7.5.1",
|
||||
"@nestjs/common": "^11.0.12",
|
||||
"@nestjs/core": "^11.0.12",
|
||||
"@nestjs/jwt": "^10.2.0",
|
||||
"@nestjs/microservices": "^11.0.12",
|
||||
"@nestjs/passport": "^10.0.3",
|
||||
"@nestjs/platform-express": "^7.5.1",
|
||||
"@nestjs/platform-express": "^11.0.12",
|
||||
"@nestjs/swagger": "^7.4.2",
|
||||
"@nestjs/typeorm": "^10.0.2",
|
||||
"@nestjs/websockets": "^11.0.12",
|
||||
"@types/eslint": "^9.6.1",
|
||||
"@types/estree": "^1.0.7",
|
||||
"aws-sdk": "^2.1692.0",
|
||||
@@ -45,13 +48,15 @@
|
||||
"pg": "^8.13.3",
|
||||
"reflect-metadata": "^0.1.14",
|
||||
"rimraf": "^3.0.2",
|
||||
"rxjs": "^7.8.0",
|
||||
"rxjs": "^7.8.2",
|
||||
"swagger-ui-express": "^5.0.1",
|
||||
"tslib": "^2.8.1",
|
||||
"typeorm": "^0.3.20"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nestjs/cli": "^7.5.1",
|
||||
"@nestjs/cli": "^11.0.5",
|
||||
"@nestjs/schematics": "^7.1.3",
|
||||
"@nestjs/testing": "^7.5.1",
|
||||
"@nestjs/testing": "^11.0.12",
|
||||
"@types/express": "^4.17.8",
|
||||
"@types/jest": "^26.0.15",
|
||||
"@types/multer": "^1.4.12",
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
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!');
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,12 +0,0 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -6,8 +6,6 @@ import { OrdersPaymentModule } from './orders-payment/orders-payment.module';
|
||||
/* eslint-disable prettier/prettier */
|
||||
|
||||
import { Module } from '@nestjs/common';
|
||||
import { AppController } from './app.controller';
|
||||
import { AppService } from './app.service';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { typeOrmConfig, typeOrmPgConfig } from './core/configs/typeorm.config';
|
||||
import { ProductsModule } from './products/products.module';
|
||||
@@ -39,8 +37,8 @@ import { LogisticService } from './logistic/logistic.service';
|
||||
TypeOrmModule.forRoot(typeOrmPgConfig),
|
||||
],
|
||||
controllers: [
|
||||
OcorrencesController, AppController, LogisticController,],
|
||||
OcorrencesController, LogisticController,],
|
||||
providers: [
|
||||
BaseService, AppService, LogisticService,],
|
||||
BaseService, LogisticService,],
|
||||
})
|
||||
export class AppModule { }
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
|
||||
@Injectable()
|
||||
export class AppService {
|
||||
getHello(): string {
|
||||
return 'Hello World!';
|
||||
}
|
||||
}
|
||||
@@ -75,7 +75,6 @@ export class LogisticService {
|
||||
|
||||
const hoje = new Date();
|
||||
|
||||
// Criar uma nova data para amanhã
|
||||
let amanha = new Date(hoje);
|
||||
amanha.setDate(hoje.getDate() + 1);
|
||||
const amanhaString = amanha.toISOString().split('T')[0];
|
||||
|
||||
31
src/main.ts
31
src/main.ts
@@ -1,27 +1,28 @@
|
||||
/* eslint-disable prettier/prettier */
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { AppModule } from './app.module';
|
||||
import * as fs from 'fs';
|
||||
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
|
||||
|
||||
async function bootstrap() {
|
||||
|
||||
// const privateKey = fs.readFileSync('cert/portal_juru.key', 'utf8');
|
||||
// const certificate = fs.readFileSync('cert/portal_juru.crt', 'utf8');
|
||||
// const httpsOptions = { key: privateKey, cert: certificate };
|
||||
// const app = await NestFactory.create(AppModule, {
|
||||
// httpsOptions,
|
||||
// });
|
||||
const app = await NestFactory.create(AppModule);
|
||||
|
||||
// const app = await NestFactory.create(AppModule);
|
||||
//Configurando o CORS
|
||||
app.enableCors({
|
||||
origin: '*', //'http://portal.jurunense.com', // Especifique a origem permitida ou use '*' para permitir todas
|
||||
methods: 'GET,HEAD,PUT,PATCH,POST,DELETE', // Métodos HTTP permitidos
|
||||
credentials: true, // Permitir envio de cookies
|
||||
allowedHeaders: 'Content-Type, Accept', // Cabeçalhos permitidos
|
||||
origin: '*',
|
||||
methods: 'GET,HEAD,PUT,PATCH,POST,DELETE',
|
||||
credentials: true,
|
||||
allowedHeaders: 'Content-Type, Accept',
|
||||
});
|
||||
|
||||
await app.listen(3001);
|
||||
const config = new DocumentBuilder()
|
||||
.setTitle('Portal Jurunense API')
|
||||
.setDescription('Documentação da API do Portal Jurunense')
|
||||
.setVersion('1.0')
|
||||
.addBearerAuth()
|
||||
.build();
|
||||
|
||||
const document = SwaggerModule.createDocument(app, config);
|
||||
SwaggerModule.setup('docs', app, document);
|
||||
|
||||
await app.listen(9000);
|
||||
}
|
||||
bootstrap();
|
||||
|
||||
Reference in New Issue
Block a user